Skip to content

Commit 1d84a25

Browse files
Release version - Port to MC1.19.4
*Sorted the Essentials creative tab Closed #88
1 parent 3e48eee commit 1d84a25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+228
-199
lines changed

build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,14 @@ dependencies {
9292
//Run with the full versions
9393
runtimeOnly fg.deobf("mezz.jei:jei-$jei_mc_version-forge:$jei_version")
9494
//Patchouli
95-
compileOnly(fg.deobf("vazkii.patchouli:Patchouli:$patchouli_version"))
96-
runtimeOnly(fg.deobf("vazkii.patchouli:Patchouli:$patchouli_version"))
95+
compileOnly(fg.deobf("vazkii.patchouli:Patchouli:$patchouli_version-FORGE"))
96+
runtimeOnly(fg.deobf("vazkii.patchouli:Patchouli:$patchouli_version-FORGE"))
9797
//CC Tweaked
98-
compileOnly(fg.deobf("org.squiddev:cc-tweaked-${mc_version}:${cctweaked_version}"))
98+
// compileOnly(fg.deobf("org.squiddev:cc-tweaked-${mc_version}:${cctweaked_version}"))
9999
// runtimeOnly(fg.deobf("org.squiddev:cc-tweaked-${mc_version}:${cctweaked_version}"))
100+
compileOnly("cc.tweaked:cc-tweaked-${mc_version}-core-api:${cctweaked_version}")
101+
compileOnly(fg.deobf("cc.tweaked:cc-tweaked-${mc_version}-forge-api:${cctweaked_version}"))
102+
// runtimeOnly(fg.deobf("cc.tweaked:cc-tweaked-${mc_version}-forge:${cctweaked_version}"))
100103
}
101104

102105
// Example for how to get properties into the manifest for reading by the runtime..

gradle.properties

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# This is required to provide enough memory for the Minecraft decompilation process.
33
org.gradle.jvmargs=-Xmx3G
44
org.gradle.daemon=false
5-
mod_version=2.15.5
6-
mc_version=1.19
7-
fg_version=41.0.98
5+
mod_version=2.15.6
6+
mc_version=1.19.4
7+
fg_version=45.1.2
88
mcp_channel=official
9-
mcp_version=1.19
10-
jei_mc_version=1.19
11-
jei_version=11.1.0.233
12-
patchouli_version=1.19-75
13-
cctweaked_version=1.100.8
9+
mcp_version=1.19.4
10+
jei_mc_version=1.19.4
11+
jei_version=13.1.0.15
12+
patchouli_version=1.19.4-79
13+
cctweaked_version=1.106.1

src/main/java/com/Da_Technomancer/essentials/ESEventHandlerClient.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import com.Da_Technomancer.essentials.render.CannonSkullRenderer;
1515
import com.Da_Technomancer.essentials.render.TESRRegistry;
1616
import com.mojang.blaze3d.vertex.PoseStack;
17-
import com.mojang.math.Matrix4f;
1817
import net.minecraft.client.Minecraft;
1918
import net.minecraft.client.gui.Font;
2019
import net.minecraft.client.gui.screens.MenuScreens;
@@ -34,12 +33,12 @@
3433
import net.minecraftforge.client.event.EntityRenderersEvent;
3534
import net.minecraftforge.client.event.InputEvent.InteractionKeyMappingTriggered;
3635
import net.minecraftforge.client.event.RenderLevelStageEvent;
37-
import net.minecraftforge.client.event.TextureStitchEvent;
3836
import net.minecraftforge.eventbus.api.SubscribeEvent;
3937
import net.minecraftforge.fml.common.Mod;
4038
import net.minecraftforge.network.IContainerFactory;
4139
import net.minecraftforge.registries.ForgeRegistries;
4240
import net.minecraftforge.registries.RegisterEvent;
41+
import org.joml.Matrix4f;
4342

4443
import java.util.ArrayList;
4544

@@ -77,13 +76,6 @@ private static <T extends AbstractContainerMenu> void registerCon(IContainerFact
7776
MenuScreens.register(contType, screenFactory);
7877
}
7978

80-
@SubscribeEvent
81-
@SuppressWarnings("unused")
82-
public static void onTextureStitch(TextureStitchEvent.Pre event){
83-
//Add textures used in TESRs
84-
//Currently none used
85-
}
86-
8779
@SuppressWarnings("unused")
8880
@SubscribeEvent
8981
public static void registerRenderers(EntityRenderersEvent.RegisterRenderers e){
@@ -128,7 +120,7 @@ private static void renderNameplate(PoseStack matrix, MultiBufferSource.BufferSo
128120
Matrix4f matrix4f = matrix.last().pose();
129121
Font fontrenderer = Minecraft.getInstance().font;
130122
float xSt = -fontrenderer.width(nameplate) / 2F;
131-
fontrenderer.drawInBatch(nameplate, xSt, 0, -1, false, matrix4f, buffer, false, 0, 0xf000f0);
123+
fontrenderer.drawInBatch(nameplate, xSt, 0, -1, false, matrix4f, buffer, Font.DisplayMode.NORMAL, 0, 0xf000f0);
132124
buffer.endBatch();
133125
matrix.popPose();
134126
}

src/main/java/com/Da_Technomancer/essentials/ESEventHandlerCommon.java

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@
88
import com.Da_Technomancer.essentials.blocks.WitherCannon;
99
import com.Da_Technomancer.essentials.items.ESItems;
1010
import net.minecraft.core.BlockPos;
11+
import net.minecraft.network.chat.Component;
12+
import net.minecraft.resources.ResourceLocation;
1113
import net.minecraft.server.level.ServerLevel;
1214
import net.minecraft.world.entity.TamableAnimal;
1315
import net.minecraft.world.entity.animal.Animal;
1416
import net.minecraft.world.entity.monster.EnderMan;
1517
import net.minecraft.world.entity.monster.Witch;
18+
import net.minecraft.world.flag.FeatureFlags;
1619
import net.minecraft.world.inventory.AbstractContainerMenu;
1720
import net.minecraft.world.inventory.MenuType;
18-
import net.minecraft.world.item.Item;
19-
import net.minecraft.world.level.block.Block;
21+
import net.minecraft.world.item.ItemStack;
2022
import net.minecraft.world.level.block.entity.BlockEntityType;
2123
import net.minecraft.world.level.block.state.BlockState;
2224
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
25+
import net.minecraftforge.event.CreativeModeTabEvent;
2326
import net.minecraftforge.event.entity.EntityTeleportEvent;
24-
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
27+
import net.minecraftforge.event.entity.living.MobSpawnEvent;
2528
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
2629
import net.minecraftforge.eventbus.api.Event;
2730
import net.minecraftforge.eventbus.api.SubscribeEvent;
@@ -32,8 +35,7 @@
3235

3336
import java.util.HashSet;
3437
import java.util.Map;
35-
36-
import static com.Da_Technomancer.essentials.blocks.ESBlocks.toRegister;
38+
import java.util.function.Supplier;
3739

3840
public class ESEventHandlerCommon{
3941

@@ -49,22 +51,10 @@ public static void registerCapabilities(RegisterCapabilitiesEvent e){
4951
@SuppressWarnings("unused")
5052
@SubscribeEvent
5153
public static void register(RegisterEvent e){
52-
e.register(ForgeRegistries.Keys.BLOCKS, helper -> {
53-
ESBlocks.init();
54-
for(Map.Entry<String, Block> block : toRegister.entrySet()){
55-
helper.register(block.getKey(), block.getValue());
56-
}
57-
toRegister.clear();
58-
});
59-
60-
e.register(ForgeRegistries.Keys.ITEMS, helper -> {
61-
ESItems.init();
62-
for(Map.Entry<String, Item> item : ESItems.toRegister.entrySet()){
63-
helper.register(item.getKey(), item.getValue());
64-
}
65-
ESItems.toRegister.clear();
66-
});
67-
54+
e.register(ForgeRegistries.Keys.BLOCKS, ESBlocks::init);
55+
56+
e.register(ForgeRegistries.Keys.ITEMS, ESItems::init);
57+
6858
e.register(ForgeRegistries.Keys.ENTITY_TYPES, helper -> {
6959
helper.register("cannon_skull", WitherCannon.CannonSkull.ENT_TYPE);
7060
});
@@ -78,6 +68,22 @@ public static void register(RegisterEvent e){
7868
});
7969
}
8070

71+
@SuppressWarnings("unused")
72+
@SubscribeEvent
73+
public static void registerCreativeTabs(CreativeModeTabEvent.Register e){
74+
ESItems.ESSENTIALS_TAB = e.registerCreativeModeTab(new ResourceLocation(Essentials.MODID, "core"), builder -> builder
75+
.title(Component.translatable("item_group." + Essentials.MODID))
76+
.icon(() -> new ItemStack(ESItems.itemCandleLilypad))
77+
.displayItems((params, output) -> {
78+
for(Supplier<ItemStack[]> itemsToAdd : ESItems.creativeTabItems){
79+
for(ItemStack itemToAdd : itemsToAdd.get()){
80+
output.accept(itemToAdd);
81+
}
82+
}
83+
}
84+
));
85+
}
86+
8187
/**
8288
* Creates and registers a container type
8389
* @param cons Container factory
@@ -87,15 +93,15 @@ public static void register(RegisterEvent e){
8793
* @return The newly created type
8894
*/
8995
protected static <T extends AbstractContainerMenu> MenuType<T> registerConType(IContainerFactory<T> cons, String id, RegisterEvent.RegisterHelper<MenuType<?>> helper){
90-
MenuType<T> contType = new MenuType<>(cons);
96+
MenuType<T> contType = new MenuType<>(cons, FeatureFlags.VANILLA_SET);
9197
helper.register(id, contType);
9298
return contType;
9399
}
94100
}
95101

96102
@SuppressWarnings("unused")
97103
@SubscribeEvent
98-
public static void blockWitchSpawns(LivingSpawnEvent.CheckSpawn e){
104+
public static void blockWitchSpawns(MobSpawnEvent.FinalizeSpawn e){
99105
//Prevents witch spawning if a nearby brazier has soulsand
100106
if(e.getEntity() instanceof Witch && e.getLevel() instanceof ServerLevel world){
101107
int RANGE = ESConfig.brazierRange.get();
@@ -107,7 +113,7 @@ public static void blockWitchSpawns(LivingSpawnEvent.CheckSpawn e){
107113
if(otherPos.distToCenterSqr(e.getX(), e.getY(), e.getZ()) <= RANGE_SQUARED){
108114
BlockState state = world.getBlockState(otherPos);
109115
if(state.getBlock() == ESBlocks.brazier && state.getValue(ESProperties.BRAZIER_CONTENTS) == 6){
110-
e.setResult(Event.Result.DENY);
116+
e.setSpawnCancelled(true);
111117
return;
112118
}
113119
}

src/main/java/com/Da_Technomancer/essentials/blocks/AbstractShifter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ public abstract class AbstractShifter extends TEBlock{
2323

2424
protected AbstractShifter(String name){
2525
super(ESBlocks.getMetalProperty());
26-
ESBlocks.toRegister.put(name, this);
27-
ESBlocks.blockAddQue(name, this);
26+
ESBlocks.queueForRegister(name, this);
2827
}
2928

3029
@Nullable

src/main/java/com/Da_Technomancer/essentials/blocks/AbstractSplitter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ public abstract class AbstractSplitter extends TEBlock{
2323

2424
protected AbstractSplitter(String name, Properties prop){
2525
super(prop);
26-
ESBlocks.toRegister.put(name, this);
27-
ESBlocks.blockAddQue(name, this);
26+
ESBlocks.queueForRegister(name, this);
2827
}
2928

3029
protected abstract boolean isBasic();

src/main/java/com/Da_Technomancer/essentials/blocks/AnalogLamp.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ public class AnalogLamp extends Block{
2626
protected AnalogLamp(){
2727
super(Properties.of(Material.BUILDABLE_GLASS).lightLevel(state -> state.getValue(ESProperties.REDSTONE)).strength(0.3F).sound(SoundType.GLASS).isValidSpawn(AnalogLamp::propagateFunction));
2828
String name = "analog_lamp";
29-
ESBlocks.toRegister.put(name, this);
30-
ESBlocks.blockAddQue(name, this);
29+
ESBlocks.queueForRegister(name, this);
3130
}
3231

3332
private static Boolean propagateFunction(BlockState state, BlockGetter world, BlockPos pos, EntityType<?> type){

src/main/java/com/Da_Technomancer/essentials/blocks/AutoCrafter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ public class AutoCrafter extends TEBlock{
2525
protected AutoCrafter(){
2626
this("auto_crafter");
2727
String name = "auto_crafter";
28-
ESBlocks.toRegister.put(name, this);
29-
ESBlocks.blockAddQue(name, this);
28+
ESBlocks.queueForRegister(name, this);
3029
}
3130

3231
protected AutoCrafter(String name){

src/main/java/com/Da_Technomancer/essentials/blocks/AutoCrafterTileEntity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ public void redstoneUpdate(boolean newReds){
168168
ItemStack output;
169169
if(recipe != null){
170170
//If the recipe ID is nonnull, then the fake crafting inv was made with the empty manual input slots, and we should use the generic output
171-
output = iRecipe.getResultItem();
171+
output = iRecipe.getResultItem(level.registryAccess());
172172
}else{
173-
output = iRecipe.assemble(fakeInv);
173+
output = iRecipe.assemble(fakeInv, level.registryAccess());
174174
}
175175

176176
//Check if the output can fit

src/main/java/com/Da_Technomancer/essentials/blocks/Brazier.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ protected Brazier(){
4949
));
5050
String name = "brazier";
5151
registerDefaultState(defaultBlockState().setValue(ESProperties.BRAZIER_CONTENTS, 0));
52-
ESBlocks.toRegister.put(name, this);
53-
ESBlocks.blockAddQue(name, this);
52+
ESBlocks.queueForRegister(name, this);
5453
}
5554

5655
@Override

src/main/java/com/Da_Technomancer/essentials/blocks/CandleLilyPad.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class CandleLilyPad extends WaterlilyBlock{
1919
protected CandleLilyPad(){
2020
super(BlockBehaviour.Properties.of(Material.PLANT).strength(0).sound(SoundType.GRASS).lightLevel(s -> 14).noOcclusion());
2121
String name = "candle_lilypad";
22-
ESBlocks.toRegister.put(name, this);
22+
ESBlocks.queueForRegister(name, this, false);
2323
}
2424

2525
@Override

src/main/java/com/Da_Technomancer/essentials/blocks/DecorativeBlock.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ public class DecorativeBlock extends Block{
1313

1414
public DecorativeBlock(String name, Properties properties){
1515
super(properties);
16-
ESBlocks.toRegister.put(name, this);
17-
ESBlocks.blockAddQue(name, this);
16+
ESBlocks.queueForRegister(name, this);
1817
}
1918

2019
@Override

src/main/java/com/Da_Technomancer/essentials/blocks/ESBlocks.java

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
import net.minecraft.world.level.block.*;
88
import net.minecraft.world.level.block.state.BlockBehaviour;
99
import net.minecraft.world.level.material.Material;
10+
import net.minecraftforge.registries.RegisterEvent;
1011

1112
import java.util.HashMap;
13+
import java.util.Map;
1214

1315
public class ESBlocks{
1416

@@ -94,9 +96,9 @@ public class ESBlocks{
9496
public static DecorativeBlock bricksBronze;
9597
public static DecorativeBlock bricksCopshowium;
9698

97-
public static final HashMap<String, Block> toRegister = new HashMap<>();
99+
private static final HashMap<String, Block> toRegister = new HashMap<>();
98100

99-
public static final Item.Properties itemBlockProp = new Item.Properties().tab(ESItems.TAB_ESSENTIALS);
101+
public static final Item.Properties itemBlockProp = new Item.Properties();
100102

101103
public static BlockBehaviour.Properties getMetalProperty(){
102104
return BlockBehaviour.Properties.of(Material.METAL).sound(SoundType.METAL).strength(3).requiresCorrectToolForDrops();
@@ -107,22 +109,38 @@ public static BlockBehaviour.Properties getRockProperty(){
107109
}
108110

109111
/**
110-
* Registers the item form of a blocks and the item model.
111-
* @param block The blocks to register
112-
* @return The passed blocks for convenience.
112+
* Queues up a block to be registered, along with an itemblock added to the creative tab
113+
* @param regName Block registry name (without essentials: prefix)
114+
* @param block Block
115+
* @return The block
116+
* @param <T> Block class
113117
*/
114-
public static <T extends Block> T blockAddQue(String regName, T block){
115-
Item item = new BlockItem(block, itemBlockProp);
116-
ESItems.toRegister.put(regName, item);
118+
public static <T extends Block> T queueForRegister(String regName, T block){
119+
return queueForRegister(regName, block, true);
120+
}
121+
122+
/**
123+
* Queues up a block to be registered, optionally along with an itemblock added to the creative tab
124+
* @param regName Block registry name (without essentials: prefix)
125+
* @param block Block
126+
* @param itemBlock Whether to create and register an associated itemblock
127+
* @return The block
128+
* @param <T> Block class
129+
*/
130+
public static <T extends Block> T queueForRegister(String regName, T block, boolean itemBlock){
131+
toRegister.put(regName, block);
132+
if(itemBlock){
133+
Item item = new BlockItem(block, itemBlockProp);
134+
ESItems.queueForRegister(regName, item);
135+
}
117136
return block;
118137
}
119138

120-
public static void init(){
139+
public static void init(RegisterEvent.RegisterHelper<Block> helper){
121140
brazier = new Brazier();
122141
slottedChest = new SlottedChest();
123142
sortingHopper = new SortingHopper();
124143
speedHopper = new SpeedHopper();
125-
candleLilyPad = new CandleLilyPad();
126144
fertileSoilWheat = new FertileSoil("wheat", Blocks.WHEAT.defaultBlockState().setValue(CropBlock.AGE, 0), FertileSoil.SeedCategory.CROP);
127145
fertileSoilCarrot = new FertileSoil("carrot", Blocks.CARROTS.defaultBlockState().setValue(CropBlock.AGE, 0), FertileSoil.SeedCategory.CROP);
128146
fertileSoilPotato = new FertileSoil("potato", Blocks.POTATOES.defaultBlockState().setValue(CropBlock.AGE, 0), FertileSoil.SeedCategory.CROP);
@@ -140,15 +158,15 @@ public static void init(){
140158
hopperFilter = new HopperFilter();
141159
itemChute = new ItemChute();
142160
itemShifter = new ItemShifter();
161+
basicItemSplitter = new BasicItemSplitter();
162+
itemSplitter = new ItemSplitter();
143163
fluidShifter = new FluidShifter();
164+
basicFluidSplitter = new BasicFluidSplitter();
165+
fluidSplitter = new FluidSplitter();
144166
multiPistonExtend = new MultiPistonExtend(false);
145167
multiPistonExtendSticky = new MultiPistonExtend(true);
146168
multiPiston = new MultiPistonBase(false);
147169
multiPistonSticky = new MultiPistonBase(true);
148-
basicItemSplitter = new BasicItemSplitter();
149-
itemSplitter = new ItemSplitter();
150-
basicFluidSplitter = new BasicFluidSplitter();
151-
fluidSplitter = new FluidSplitter();
152170
witherCannon = new WitherCannon();
153171
autoCrafter = new AutoCrafter();
154172
analogLamp = new AnalogLamp();
@@ -159,6 +177,7 @@ public static void init(){
159177
bricksTin = new DecorativeBlock("bricks_tin", getMetalProperty());
160178
bricksBronze = new DecorativeBlock("bricks_bronze", getMetalProperty());
161179
bricksCopshowium = new DecorativeBlock("bricks_copshowium", getMetalProperty());
180+
candleLilyPad = new CandleLilyPad();//Itemblock registered separately
162181

163182
//Circuits
164183
wireCircuit = new WireCircuit();
@@ -204,5 +223,11 @@ public static void init(){
204223
pulseCircuitFalling = new PulseCircuit(PulseCircuit.Edge.FALLING);
205224
pulseCircuitDual = new PulseCircuit(PulseCircuit.Edge.DUAL);
206225
dCounterCircuit = new DCounterCircuit();
226+
227+
228+
for(Map.Entry<String, Block> block : toRegister.entrySet()){
229+
helper.register(block.getKey(), block.getValue());
230+
}
231+
toRegister.clear();
207232
}
208233
}

src/main/java/com/Da_Technomancer/essentials/blocks/FertileSoil.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ protected FertileSoil(String plantName, BlockState plant, SeedCategory category)
3131
this.plant = plant;
3232
this.category = category;
3333
String name = "fertile_soil_" + plantName;
34-
ESBlocks.toRegister.put(name, this);
35-
ESBlocks.blockAddQue(name, this);
34+
ESBlocks.queueForRegister(name, this);
3635
}
3736

3837
@Override

0 commit comments

Comments
 (0)