Skip to content

Commit

Permalink
Backport to 1.19-1.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
FakeDomi committed Sep 18, 2023
1 parent 6fa09fd commit 0bdaca2
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 219 deletions.
8 changes: 3 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -28,10 +28,8 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"

include modApi("teamreborn:energy:${project.reborn_energy_version}")
modRuntimeOnly "TechReborn:TechReborn-1.19:${project.tech_reborn_version}", { exclude(group: "me.shedaniel") }
include modApi("teamreborn:energy:${project.reborn_energy_version}") { transitive = false }
modCompileOnly "TechReborn:TechReborn-1.19:${project.tech_reborn_version}", { transitive = false }
}

processResources {
Expand Down
15 changes: 7 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
loader_version=0.14.21
minecraft_version=1.19
yarn_mappings=1.19+build.4
loader_version=0.14.22

# Mod Properties
mod_version=7.3+1.19.4
mod_version=7.3+1.19
maven_group=re.domi
archives_base_name=invisiblights

# Dependencies
fabric_version=0.79.0+1.19.4
fabric_version=0.58.0+1.19

mod_menu_version=6.3.1
reborn_energy_version=3.0.0
tech_reborn_version=5.7.0
reborn_energy_version=2.3.0
tech_reborn_version=5.3.2
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
23 changes: 4 additions & 19 deletions src/main/java/re/domi/invisiblights/InvisibLights.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package re.domi.invisiblights;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import re.domi.invisiblights.config.Config;

@SuppressWarnings("WeakerAccess")
Expand All @@ -26,20 +22,9 @@ public void onInitialize()
{
Config.read();

LightRod = Registry.register(Registries.ITEM, new Identifier("invisiblights", "light_rod"), new LightRodItem());
PoweredLightRod = Registry.register(Registries.ITEM, new Identifier("invisiblights", "powered_light_rod"), new PoweredLightRodItem());
LightRod = Registry.register(Registry.ITEM, new Identifier("invisiblights", "light_rod"), new LightRodItem());
PoweredLightRod = Registry.register(Registry.ITEM, new Identifier("invisiblights", "powered_light_rod"), new PoweredLightRodItem());

LightSource = Registry.register(Registries.BLOCK, new Identifier("invisiblights", "light_source"), new LightSourceBlock());

ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(entries ->
{
entries.add(new ItemStack(LightRod));
entries.add(new ItemStack(PoweredLightRod));

ItemStack fullyCharged = new ItemStack(PoweredLightRod);
PoweredLightRod.setStoredEnergy(fullyCharged, PoweredLightRod.getEnergyCapacity(fullyCharged));

entries.add(fullyCharged);
});
LightSource = Registry.register(Registry.BLOCK, new Identifier("invisiblights", "light_source"), new LightSourceBlock());
}
}
2 changes: 1 addition & 1 deletion src/main/java/re/domi/invisiblights/LightRodItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class LightRodItem extends Item
{
public LightRodItem()
{
super(new Settings().maxCount(1));
super(new Settings().group(ItemGroup.TOOLS).maxCount(1));
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/re/domi/invisiblights/LightSourceBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po
}

@Override
public boolean isTransparent(BlockState state, BlockView world, BlockPos pos)
public boolean isTranslucent(BlockState state, BlockView world, BlockPos pos)
{
return !state.get(Properties.WATERLOGGED);
}
Expand All @@ -66,7 +66,7 @@ public BlockState getStateForNeighborUpdate(BlockState state, Direction directio
{
if (state.get(Properties.WATERLOGGED))
{
world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
}

return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/re/domi/invisiblights/PoweredLightRodItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import net.minecraft.block.Blocks;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.ColorHelper;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -85,4 +87,18 @@ public long getEnergyMaxOutput(ItemStack stack)
{
return 0;
}

@Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks)
{
if (this.isIn(group))
{
stacks.add(new ItemStack(this));

ItemStack fullyCharged = new ItemStack(this);
this.setStoredEnergy(fullyCharged, this.getEnergyCapacity(fullyCharged));

stacks.add(fullyCharged);
}
}
}
165 changes: 0 additions & 165 deletions src/main/java/re/domi/invisiblights/config/ConfigScreen.java

This file was deleted.

13 changes: 0 additions & 13 deletions src/main/java/re/domi/invisiblights/config/ModMenuImpl.java

This file was deleted.

7 changes: 2 additions & 5 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
],
"client": [
"re.domi.invisiblights.InvisibLightsClient"
],
"modmenu": [
"re.domi.invisiblights.config.ModMenuImpl"
]
},
"mixins": [
Expand All @@ -35,7 +32,7 @@

"depends": {
"fabricloader": ">=0.9.0",
"fabric-api": "*",
"minecraft": ">=1.19.4"
"fabric": "*",
"minecraft": ">=1.19"
}
}

0 comments on commit 0bdaca2

Please sign in to comment.