Skip to content

Commit 3a54dcd

Browse files
committed
untested new beta
1 parent 1e7ea69 commit 3a54dcd

File tree

256 files changed

+1508
-2697
lines changed

Some content is hidden

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

256 files changed

+1508
-2697
lines changed

src/main/java/me/gleep/oreganized/Oreganized.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
import net.minecraft.client.multiplayer.ClientLevel;
88
import net.minecraft.client.renderer.ItemBlockRenderTypes;
99
import net.minecraft.client.renderer.RenderType;
10+
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
11+
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
12+
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
1013
import net.minecraft.client.renderer.item.ItemProperties;
14+
import net.minecraft.client.renderer.item.ItemPropertyFunction;
1115
import net.minecraft.resources.ResourceLocation;
1216
import net.minecraft.world.entity.LivingEntity;
1317
import net.minecraft.world.item.ItemStack;
@@ -84,9 +88,13 @@ private void doClientStuff(final FMLClientSetupEvent event) {
8488
ItemBlockRenderTypes.setRenderLayer(RegistryHandler.WHITE_CRYSTAL_GLASS_PANE.get(), RenderType.translucent());
8589
ItemBlockRenderTypes.setRenderLayer(RegistryHandler.YELLOW_CRYSTAL_GLASS_PANE.get(), RenderType.translucent());
8690

87-
ItemBlockRenderTypes.setRenderLayer(RegistryHandler.LEAD_FLUID.get(), RenderType.waterMask());
88-
//ItemBlockRenderTypes.setRenderLayer(RegistryHandler.LEAD_FLUID_BLOCK.get(), RenderType.getSolid());
91+
ItemBlockRenderTypes.setRenderLayer(RegistryHandler.MOLTEN_LEAD_BLOCK.get(), RenderType.translucent());
8992

93+
event.enqueueWork(() -> ItemProperties.register(RegistryHandler.SILVER_INGOT.get(),
94+
new ResourceLocation(Oreganized.MOD_ID + ":shine"),
95+
(ItemStack p_174676_, @Nullable ClientLevel p_174677_, @Nullable LivingEntity p_174678_, int p_174679_) ->
96+
p_174676_.getTag() != null ? (p_174676_.getTag().getBoolean("Shine") ? 1 : 0) : 0)
97+
);
9098
event.enqueueWork(() -> ItemProperties.register(RegistryHandler.SILVER_MIRROR.get(),
9199
new ResourceLocation(Oreganized.MOD_ID + ":dist"),
92100
(ItemStack p_174676_, @Nullable ClientLevel p_174677_, @Nullable LivingEntity p_174678_, int p_174679_) ->

src/main/java/me/gleep/oreganized/blocks/ExposerBlock.java

+6-11
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import net.minecraft.world.level.block.entity.BlockEntity;
1515
import net.minecraft.world.level.block.entity.BlockEntityTicker;
1616
import net.minecraft.world.level.block.entity.BlockEntityType;
17-
import net.minecraft.world.level.block.entity.HopperBlockEntity;
1817
import net.minecraft.world.level.block.state.BlockBehaviour;
1918
import net.minecraft.world.level.block.state.BlockState;
2019
import net.minecraft.world.level.block.state.StateDefinition;
@@ -28,6 +27,7 @@
2827
import java.util.Random;
2928

3029
public class ExposerBlock extends DirectionalBlock implements EntityBlock {
30+
public static final float RANGE = 16.0f;
3131
public static final IntegerProperty LEVEL = BlockStateProperties.AGE_3;
3232
public static final int[] POWER_STATES = new int[] {0, 1, 2, 3};
3333
boolean isUndeadNearby = false;
@@ -64,19 +64,14 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level p_153212_, B
6464
return ExposerBlockEntity::tick;
6565
}
6666

67-
/*@Nullable
68-
public BlockEntityTicker<ExposerBlockEntity> getTicker(Level level, BlockState blockState, BlockEntityType<T> blockEntityType) {
69-
return level.isClientSide ? null : ExposerBlockEntity::tick;
70-
}*/
71-
7267
@Override
7368
public boolean isSignalSource(BlockState p_60571_) {
7469
return true;
7570
}
7671

7772
@Override
7873
public int getSignal(BlockState p_60483_, BlockGetter p_60484_, BlockPos p_60485_, Direction p_60486_) {
79-
return p_60483_.getSignal(p_60484_, p_60485_, p_60486_);
74+
return p_60483_.getDirectSignal(p_60484_, p_60485_, p_60486_);
8075
}
8176

8277
@Override
@@ -104,8 +99,8 @@ public void tick(BlockState p_60462_, ServerLevel p_60463_, BlockPos p_60464_, R
10499
int dist = 4;
105100

106101
List<Entity> list = p_60463_.getEntities((Entity) null,
107-
new AABB(p_60464_.getX() + SilverBlock.RANGE, p_60464_.getY() + SilverBlock.RANGE, p_60464_.getZ() + SilverBlock.RANGE,
108-
p_60464_.getX() - SilverBlock.RANGE, p_60464_.getY() - SilverBlock.RANGE, p_60464_.getZ() - SilverBlock.RANGE),
102+
new AABB(p_60464_.getX() + RANGE, p_60464_.getY() + RANGE, p_60464_.getZ() + RANGE,
103+
p_60464_.getX() - RANGE, p_60464_.getY() - RANGE, p_60464_.getZ() - RANGE),
109104
(Entity entity) -> entity instanceof LivingEntity
110105
);
111106

@@ -114,10 +109,10 @@ public void tick(BlockState p_60462_, ServerLevel p_60463_, BlockPos p_60464_, R
114109
if (living.isInvertedHealAndHarm()) {
115110
isUndeadNearby = true;
116111
double distance = Mth.sqrt((float) living.distanceToSqr(p_60464_.getX(), p_60464_.getY(), p_60464_.getZ()));
117-
if (distance < SilverBlock.RANGE && ((int) Math.ceil(distance / (SilverBlock.RANGE / 4))) < dist) {
112+
if (distance < RANGE && ((int) Math.ceil(distance / (RANGE / 4))) < dist) {
118113
if (distance <= 6) {
119114
dist = 1;
120-
} else dist = Math.max((int) Math.ceil(distance / (SilverBlock.RANGE / 4)), 2);
115+
} else dist = Math.max((int) Math.ceil(distance / (RANGE / 4)), 2);
121116

122117
if (dist > 3) {
123118
dist = 3;

src/main/java/me/gleep/oreganized/blocks/LeadOre.java

-17
This file was deleted.

src/main/java/me/gleep/oreganized/blocks/MoltenLeadBlock.java

+45-48
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import net.minecraft.core.Direction;
77
import net.minecraft.sounds.SoundEvent;
88
import net.minecraft.sounds.SoundEvents;
9+
import net.minecraft.tags.FluidTags;
910
import net.minecraft.world.InteractionHand;
1011
import net.minecraft.world.InteractionResult;
1112
import net.minecraft.world.entity.Entity;
@@ -14,6 +15,7 @@
1415
import net.minecraft.world.entity.player.Player;
1516
import net.minecraft.world.item.ItemStack;
1617
import net.minecraft.world.item.Items;
18+
import net.minecraft.world.item.context.BlockPlaceContext;
1719
import net.minecraft.world.level.BlockGetter;
1820
import net.minecraft.world.level.Level;
1921
import net.minecraft.world.level.LevelAccessor;
@@ -23,28 +25,63 @@
2325
import net.minecraft.world.level.block.entity.BlockEntity;
2426
import net.minecraft.world.level.block.state.BlockBehaviour;
2527
import net.minecraft.world.level.block.state.BlockState;
28+
import net.minecraft.world.level.gameevent.GameEvent;
2629
import net.minecraft.world.level.material.FluidState;
2730
import net.minecraft.world.level.material.Material;
31+
import net.minecraft.world.level.material.MaterialColor;
2832
import net.minecraft.world.level.pathfinder.BlockPathTypes;
2933
import net.minecraft.world.phys.BlockHitResult;
3034
import net.minecraft.world.phys.Vec3;
3135
import net.minecraft.world.phys.shapes.CollisionContext;
3236
import net.minecraft.world.phys.shapes.EntityCollisionContext;
3337
import net.minecraft.world.phys.shapes.Shapes;
3438
import net.minecraft.world.phys.shapes.VoxelShape;
39+
import net.minecraftforge.client.IBlockRenderProperties;
3540

3641
import javax.annotation.Nullable;
3742
import java.util.Optional;
43+
import java.util.function.Consumer;
3844

3945
public class MoltenLeadBlock extends Block implements BucketPickup {
4046
public MoltenLeadBlock() {
41-
super(BlockBehaviour.Properties.of(Material.LAVA)
47+
super(BlockBehaviour.Properties.of((new Material.Builder(MaterialColor.COLOR_PURPLE)).noCollider().nonSolid().liquid().build())
4248
.strength(-1.0F, 3600000.0F)
4349
.noDrops()
4450
.requiresCorrectToolForDrops());
4551
}
4652

4753

54+
55+
@Override
56+
public boolean skipRendering(BlockState p_60532_, BlockState p_60533_, Direction p_60534_) {
57+
return super.skipRendering(p_60532_, p_60533_, p_60534_);
58+
}
59+
60+
@Override
61+
public BlockState updateShape(BlockState state, Direction p_60542_, BlockState neighbour, LevelAccessor level, BlockPos pos, BlockPos neighbourPos) {
62+
if (level.isWaterAt(neighbourPos)) {
63+
level.levelEvent(1501, pos, 0);
64+
65+
return RegistryHandler.LEAD_BLOCK.get().defaultBlockState();
66+
}
67+
68+
return super.updateShape(state, p_60542_, neighbour, level, pos, neighbourPos);
69+
}
70+
71+
@Override
72+
public void neighborChanged(BlockState p_60509_, Level level, BlockPos pos, Block p_60512_, BlockPos neighbourPos, boolean p_60514_) {
73+
if (level.getFluidState(neighbourPos).is(FluidTags.WATER)) {
74+
level.setBlockAndUpdate(pos, RegistryHandler.LEAD_BLOCK.get().defaultBlockState());
75+
76+
level.levelEvent(1501, pos, 0);
77+
} else if (level.getFluidState(neighbourPos).is(FluidTags.LAVA)) {
78+
79+
}
80+
81+
82+
super.neighborChanged(p_60509_, level, pos, p_60512_, neighbourPos, p_60514_);
83+
}
84+
4885
/**
4986
* Get the {@code PathNodeType} for this block. Return {@code null} for vanilla behavior.
5087
*
@@ -74,33 +111,6 @@ public boolean canEntityDestroy(BlockState state, BlockGetter world, BlockPos po
74111
return false;
75112
}
76113

77-
@Override
78-
public void playerWillDestroy(Level p_49852_, BlockPos p_49853_, BlockState p_49854_, Player p_49855_) { }
79-
80-
/**
81-
* Called when a player removes a block. This is responsible for
82-
* actually destroying the block, and the block is intact at time of call.
83-
* This is called regardless of whether the player can harvest the block or
84-
* not.
85-
* <p>
86-
* Return true if the block is actually destroyed.
87-
* <p>
88-
* Note: When used in multiplayer, this is called on both client and
89-
* server sides!
90-
*
91-
* @param state The current state.
92-
* @param world The current world
93-
* @param pos Block position in world
94-
* @param player The player damaging the block, may be null
95-
* @param willHarvest True if Block.harvestBlock will be called after this, if the return in true.
96-
* Can be useful to delay the destruction of tile entities till after harvestBlock
97-
* @param fluid The current fluid state at current position
98-
* @return True if the block is actually destroyed.
99-
*/
100-
@Override
101-
public boolean removedByPlayer(BlockState state, Level world, BlockPos pos, Player player, boolean willHarvest, FluidState fluid) {
102-
return false;
103-
}
104114

105115
@Override
106116
public int getLightBlock(BlockState p_60585_, BlockGetter p_60586_, BlockPos p_60587_) {
@@ -118,25 +128,16 @@ public VoxelShape getCollisionShape(BlockState p_60572_, BlockGetter p_60573_, B
118128
}
119129
return Shapes.empty();
120130
}
121-
122-
@Override
123-
public FluidState getFluidState(BlockState p_60577_) {
124-
return RegistryHandler.LEAD_FLUID.get().defaultFluidState();
125-
}
126-
131+
127132
@Override
128133
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
129-
//return p_60558_.isHoldingItem(Items.BUCKET) || p_60558_.isHoldingItem(RegistryHandler.MOLTEN_LEAD_BUCKET.get()) ? Shapes.block() : Shapes.empty();
130-
return Shapes.empty();
131-
}
132-
133-
/*@Override
134-
public InteractionResult use(BlockState p_60503_, Level p_60504_, BlockPos p_60505_, Player p_60506_, InteractionHand p_60507_, BlockHitResult p_60508_) {
135-
if (p_60506_.getItemInHand(p_60507_).getItem().equals(Items.BUCKET) || p_60506_.getItemInHand(p_60507_).getItem().equals(RegistryHandler.MOLTEN_LEAD_BUCKET.get())){
136-
return InteractionResult.SUCCESS;
134+
if (((EntityCollisionContext)p_60558_).getEntity().isPresent()) {
135+
return p_60558_.isHoldingItem(Items.BUCKET)
136+
|| p_60558_.isHoldingItem(RegistryHandler.MOLTEN_LEAD_BUCKET.get()) ? Shapes.block() : Shapes.empty();
137137
}
138-
return InteractionResult.PASS;
139-
}*/
138+
139+
return Shapes.block();
140+
}
140141

141142
/**
142143
* Determines if the player can harvest this block, obtaining it's drops when the block is destroyed.
@@ -178,8 +179,4 @@ public Optional<SoundEvent> getPickupSound() {
178179
return Optional.of(SoundEvents.BUCKET_FILL_LAVA);
179180
}
180181

181-
/*@Override
182-
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
183-
return state.getBlock().equals(adjacentBlockState.getBlock());
184-
}*/
185182
}

0 commit comments

Comments
 (0)