Skip to content

Commit 7a66e82

Browse files
committed
bug fixes
1 parent cf2c4d9 commit 7a66e82

8 files changed

Lines changed: 48 additions & 32 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"values": [
3+
"createaddition:bioethanol_bucket",
4+
"createaddition:seed_oil_bucket"
5+
]
6+
}

src/generated/resources/data/create/tags/block/safe_nbt.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/main/java/com/mrh0/createaddition/blocks/barbed_wire/BarbedWireBlock.java

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,36 @@
1313
import net.minecraft.world.entity.Entity;
1414
import net.minecraft.world.entity.LivingEntity;
1515
import net.minecraft.world.item.context.BlockPlaceContext;
16+
import net.minecraft.world.level.BlockGetter;
1617
import net.minecraft.world.level.Level;
1718
import net.minecraft.world.level.block.Block;
19+
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
1820
import net.minecraft.world.level.block.state.BlockState;
1921
import net.minecraft.world.level.block.state.StateDefinition.Builder;
2022
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
2123
import net.minecraft.world.level.block.state.properties.BooleanProperty;
2224
import net.minecraft.world.level.block.state.properties.DirectionProperty;
25+
import net.minecraft.world.level.material.FluidState;
26+
import net.minecraft.world.level.material.Fluids;
2327
import net.minecraft.world.phys.Vec3;
2428
import net.neoforged.neoforge.client.model.generators.BlockModelProvider;
2529
import net.neoforged.neoforge.client.model.generators.ConfiguredModel;
2630
import net.neoforged.neoforge.client.model.generators.ModelFile;
2731
import net.neoforged.neoforge.client.model.generators.VariantBlockStateBuilder;
2832
import net.neoforged.neoforge.common.IShearable;
2933

30-
public class BarbedWireBlock extends Block implements IShearable {
34+
public class BarbedWireBlock extends Block implements IShearable, SimpleWaterloggedBlock {
3135
public static final BooleanProperty VERTICAL = BooleanProperty.create("vertical");
3236
public static final DirectionProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING;
37+
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
3338

3439
public BarbedWireBlock(Properties props) {
3540
super(props);
36-
this.registerDefaultState(this.defaultBlockState().setValue(VERTICAL, false).setValue(HORIZONTAL_FACING, Direction.NORTH));
41+
this.registerDefaultState(this.defaultBlockState().setValue(VERTICAL, false).setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(WATERLOGGED, false));
42+
}
43+
44+
protected boolean propagatesSkylightDown(BlockState state, BlockGetter reader, BlockPos pos) {
45+
return !(Boolean)state.getValue(WATERLOGGED);
3746
}
3847

3948
@Override
@@ -46,18 +55,30 @@ public void entityInside(BlockState state, Level level, BlockPos pos, Entity ent
4655
entity.makeStuckInBlock(state, new Vec3(0.25D, 0.05D, 0.25D));
4756
}
4857

58+
@Override
59+
protected FluidState getFluidState(BlockState state) {
60+
return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
61+
}
62+
4963
@Override
5064
protected void createBlockStateDefinition(Builder<Block, BlockState> builder) {
51-
builder.add(VERTICAL, HORIZONTAL_FACING);
65+
builder.add(VERTICAL, HORIZONTAL_FACING, WATERLOGGED);
5266
}
5367

5468
@Override
5569
public BlockState getStateForPlacement(BlockPlaceContext c) {
70+
FluidState fluidstate = c.getLevel().getFluidState(c.getClickedPos());
5671
if(c.getPlayer() == null) return defaultBlockState();
5772
if(c.getClickedFace().getAxis() == Axis.Y)
58-
return defaultBlockState().setValue(HORIZONTAL_FACING, c.getPlayer().isShiftKeyDown() ? c.getHorizontalDirection().getClockWise() : c.getHorizontalDirection()).setValue(VERTICAL, false);
73+
return defaultBlockState()
74+
.setValue(HORIZONTAL_FACING, c.getPlayer().isShiftKeyDown() ? c.getHorizontalDirection().getClockWise() : c.getHorizontalDirection())
75+
.setValue(VERTICAL, false)
76+
.setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER);
5977
else
60-
return defaultBlockState().setValue(HORIZONTAL_FACING, c.getClickedFace().getOpposite()).setValue(VERTICAL, true);
78+
return defaultBlockState()
79+
.setValue(HORIZONTAL_FACING, c.getClickedFace().getOpposite())
80+
.setValue(VERTICAL, true)
81+
.setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER);
6182
}
6283

6384
public static void makeBlockState(DataGenContext<Block, BarbedWireBlock> ctx, RegistrateBlockstateProvider provider) {

src/main/java/com/mrh0/createaddition/blocks/rolling_mill/RollingMillBlockEntity.java

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,8 @@ public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
7070
public void tickAudio() {
7171
super.tickAudio();
7272

73-
if (getSpeed() == 0)
74-
return;
75-
if (inputInv.getStackInSlot(0)
76-
.isEmpty())
77-
return;
73+
if (getSpeed() == 0) return;
74+
if (inputInv.getStackInSlot(0).isEmpty()) return;
7875

7976
float pitch = Mth.clamp((Math.abs(getSpeed()) / 256f) + .45f, .85f, 1f);
8077
SoundScapes.play(SoundScapes.AmbienceGroup.MILLING, worldPosition, pitch);
@@ -84,8 +81,7 @@ public void tickAudio() {
8481
public void tick() {
8582
super.tick();
8683

87-
if (getSpeed() == 0)
88-
return;
84+
if (getSpeed() == 0) return;
8985
for (int i = 0; i < outputInv.getSlots(); i++)
9086
if (outputInv.getStackInSlot(i)
9187
.getCount() == outputInv.getSlotLimit(i))
@@ -98,14 +94,11 @@ public void tick() {
9894
spawnParticles();
9995
return;
10096
}
101-
if (timer <= 0)
102-
process();
97+
if (timer <= 0) process();
10398
return;
10499
}
105100

106-
if (inputInv.getStackInSlot(0)
107-
.isEmpty())
108-
return;
101+
if (inputInv.getStackInSlot(0).isEmpty()) return;
109102

110103
RecipeWrapper inventoryIn = new RecipeWrapper(inputInv);
111104
if (lastRecipe == null || !lastRecipe.matches(inventoryIn, level)) {
@@ -143,8 +136,7 @@ private void process() {
143136

144137
if (lastRecipe == null || !lastRecipe.matches(inventoryIn, level)) {
145138
Optional<RecipeHolder<RollingRecipe>> recipe = find(inventoryIn, level);
146-
if (recipe.isEmpty())
147-
return;
139+
if (recipe.isEmpty()) return;
148140
lastRecipe = recipe.get().value();
149141
}
150142

@@ -159,8 +151,7 @@ private void process() {
159151

160152
public void spawnParticles() {
161153
ItemStack stackInSlot = inputInv.getStackInSlot(0);
162-
if (stackInSlot.isEmpty())
163-
return;
154+
if (stackInSlot.isEmpty()) return;
164155

165156
ItemParticleOption data = new ItemParticleOption(ParticleTypes.ITEM, stackInSlot);
166157
float angle = level.random.nextFloat() * 360;

src/main/java/com/mrh0/createaddition/blocks/tesla_coil/TeslaCoilBlockEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private void doDmg() {
141141
}
142142

143143
if(dmg > 0) {
144-
e.hurt(CADamageTypes.barbedWire(level), dmg);
144+
e.hurt(CADamageTypes.teslaCoil(level), dmg);
145145
if (!zapped) {
146146
if (CommonConfig.AUDIO_ENABLED.get()) level.playSound(null, worldPosition, CASounds.LOUD_ZAP.get(), SoundSource.BLOCKS, 0.6f, 1f);
147147
zapped = true;

src/main/java/com/mrh0/createaddition/datagen/TagProvider/CAItemTagProvider.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,5 +183,10 @@ protected void addTags(HolderLookup.Provider provider) {
183183
CABlocks.CHOCOLATE_CAKE.asItem(),
184184
CABlocks.HONEY_CAKE.asItem()
185185
);
186+
187+
tag(CATagRegister.Items.BUCKETS).add(
188+
CAFluids.BIOETHANOL.getBucket().get(),
189+
CAFluids.SEED_OIL.getBucket().get()
190+
);
186191
}
187192
}

src/main/java/com/mrh0/createaddition/datagen/TagProvider/CATagRegister.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public static class Items {
3232
public static final TagKey<Item> ELECTRUM_WIRES = commonTags("wires","electrum");
3333
public static final TagKey<Item> GOLD_WIRES = commonTags("wires","gold");
3434
public static final TagKey<Item> IRON_WIRES = commonTags("wires","iron");
35+
public static final TagKey<Item> BUCKETS = commonTags("buckets");
3536

3637
public static final TagKey<Item> DUSTS = commonTags("dusts");
3738
public static final TagKey<Item> FUELS = commonTags("fuels");

src/main/java/com/mrh0/createaddition/index/CABlocks.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class CABlocks {
5858

5959
public static final BlockEntry<ElectricMotorBlock> ELECTRIC_MOTOR = CreateAddition.REGISTRATE.block("electric_motor", ElectricMotorBlock::new)
6060
.initialProperties(SharedProperties::softMetal)
61-
.tag(AllBlockTags.SAFE_NBT.tag) //Dono what this tag means (contraption safe?).
61+
//.tag(AllBlockTags.SAFE_NBT.tag)
6262
//.transform(CStress.setCapacity(Config.MAX_STRESS.get()/256f))
6363
//.onRegister(BlockStressValues.setGeneratorSpeed(256, true))
6464
.transform(pickaxeOnly())
@@ -70,7 +70,7 @@ public class CABlocks {
7070
public static final BlockEntry<AlternatorBlock> ALTERNATOR = CreateAddition.REGISTRATE.block("alternator", AlternatorBlock::new)
7171
.initialProperties(SharedProperties::softMetal)
7272
//.transform(CStress.setImpact(Config.MAX_STRESS.get()/256f))
73-
.tag(AllBlockTags.SAFE_NBT.tag) //Dono what this tag means (contraption safe?).
73+
//.tag(AllBlockTags.SAFE_NBT.tag)
7474
.transform(pickaxeOnly())
7575
.blockstate(BlockGenHelper.directionalBlockState())
7676
.item()
@@ -80,7 +80,6 @@ public class CABlocks {
8080
public static final BlockEntry<RollingMillBlock> ROLLING_MILL = CreateAddition.REGISTRATE.block("rolling_mill", RollingMillBlock::new)
8181
.initialProperties(SharedProperties::stone)
8282
//.transform(CStress.setImpact(Config.ROLLING_MILL_STRESS.get()))
83-
.tag(AllBlockTags.SAFE_NBT.tag) //Dono what this tag means (contraption safe?).
8483
.transform(axeOrPickaxe())
8584
.blockstate(BlockGenHelper.horizontalBlockState())
8685
.item()

0 commit comments

Comments
 (0)