mappings. More colors and materials

This commit is contained in:
gnembon committed 2020-11-06 23:10:43 -04:00
1 parent 94b47c1272
commit d48896ad8b
25 files changed
+164 -144

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html # or better: https://modmuss50.me/fabric.html
minecraft_version=20w45a minecraft_version=20w45a
yarn_mappings=20w45a+build.6 yarn_mappings=20w45a+build.20
loader_version=0.10.6+build.214 loader_version=0.10.6+build.214
# Mod Properties # Mod Properties
@@ -49,7 +49,7 @@ public class BlockRotator
{ {
public static boolean flipBlockWithCactus(BlockState state, World world, PlayerEntity player, Hand hand, BlockHitResult hit) public static boolean flipBlockWithCactus(BlockState state, World world, PlayerEntity player, Hand hand, BlockHitResult hit)
{ //getAbilities() { //getAbilities()
if (!player.method_31549().allowModifyWorld || !CarpetSettings.flippinCactus || !player_holds_cactus_mainhand(player)) if (!player.getAbilities().allowModifyWorld || !CarpetSettings.flippinCactus || !player_holds_cactus_mainhand(player))
{ {
return false; return false;
} }
@@ -248,7 +248,7 @@ public class EntityPlayerActionPack
private void dropItemFromSlot(int slot, boolean dropAll) private void dropItemFromSlot(int slot, boolean dropAll)
{ {
PlayerInventory inv = player.method_31548(); // getInventory; PlayerInventory inv = player.getInventory(); // getInventory;
if (!inv.getStack(slot).isEmpty()) if (!inv.getStack(slot).isEmpty())
player.dropItem(inv.removeStack(slot, player.dropItem(inv.removeStack(slot,
dropAll ? inv.getStack(slot).getCount() : 1 dropAll ? inv.getStack(slot).getCount() : 1
@@ -257,7 +257,7 @@ public class EntityPlayerActionPack
public void drop(int selectedSlot, boolean dropAll) public void drop(int selectedSlot, boolean dropAll)
{ {
PlayerInventory inv = player.method_31548(); // getInventory; PlayerInventory inv = player.getInventory(); // getInventory;
if (selectedSlot == -2) // all if (selectedSlot == -2) // all
{ {
for (int i = inv.size(); i >= 0; i--) for (int i = inv.size(); i >= 0; i--)
@@ -172,7 +172,7 @@ public class OptimizedExplosion
PlayerEntity player = (PlayerEntity) entity; PlayerEntity player = (PlayerEntity) entity;
if (!player.isSpectator() if (!player.isSpectator()
&& (!player.isCreative() || !player.method_31549().flying)) { //getAbilities && (!player.isCreative() || !player.getAbilities().flying)) { //getAbilities
e.getAffectedPlayers().put(player, new Vec3d(d5 * d10, d7 * d10, d9 * d10)); e.getAffectedPlayers().put(player, new Vec3d(d5 * d10, d7 * d10, d9 * d10));
} }
} }
@@ -227,7 +227,7 @@ public class OptimizedExplosion
{ {
if (block.shouldDropItemsOnExplosion(e) && world instanceof ServerWorld) if (block.shouldDropItemsOnExplosion(e) && world instanceof ServerWorld)
{ {
BlockEntity blockEntity = state.method_31709() ? world.getBlockEntity(blockpos) : null; //hasBlockEntity() BlockEntity blockEntity = state.hasBlockEntity() ? world.getBlockEntity(blockpos) : null; //hasBlockEntity()
LootContext.Builder lootBuilder = (new LootContext.Builder((ServerWorld)eAccess.getWorld())) LootContext.Builder lootBuilder = (new LootContext.Builder((ServerWorld)eAccess.getWorld()))
.random(eAccess.getWorld().random) .random(eAccess.getWorld().random)
@@ -4,7 +4,7 @@ import carpet.CarpetSettings;
import net.minecraft.block.AbstractCauldronBlock; import net.minecraft.block.AbstractCauldronBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.ShulkerBoxBlock; import net.minecraft.block.ShulkerBoxBlock;
import net.minecraft.class_5620; import net.minecraft.block.cauldron.CauldronBehavior;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -19,13 +19,13 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(AbstractCauldronBlock.class) @Mixin(AbstractCauldronBlock.class)
public class AbstractCauldronBlock_stackableSBoxesMixin public class AbstractCauldronBlock_stackableSBoxesMixin
{ {
@Redirect(method = "onUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/class_5620;interact(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/item/ItemStack;)Lnet/minecraft/util/ActionResult;")) @Redirect(method = "onUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/cauldron/CauldronBehavior;interact(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/item/ItemStack;)Lnet/minecraft/util/ActionResult;"))
private ActionResult wrapInteractor(class_5620 class_5620, BlockState blockState, World world, BlockPos blockPos, PlayerEntity playerEntity, Hand hand, ItemStack itemStack) private ActionResult wrapInteractor(CauldronBehavior cauldronBehavior, BlockState blockState, World world, BlockPos blockPos, PlayerEntity playerEntity, Hand hand, ItemStack itemStack)
{ {
int count = -1; int count = -1;
if (CarpetSettings.stackableShulkerBoxes && itemStack.getItem() instanceof BlockItem && ((BlockItem)itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock) if (CarpetSettings.stackableShulkerBoxes && itemStack.getItem() instanceof BlockItem && ((BlockItem)itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock)
count = itemStack.getCount(); count = itemStack.getCount();
ActionResult result = class_5620.interact(blockState, world, blockPos, playerEntity, hand, itemStack); ActionResult result = cauldronBehavior.interact(blockState, world, blockPos, playerEntity, hand, itemStack);
if (count > 0 && result.isAccepted()) if (count > 0 && result.isAccepted())
{ {
ItemStack current = playerEntity.getStackInHand(hand); ItemStack current = playerEntity.getStackInHand(hand);
@@ -24,7 +24,7 @@ public class BlockItem_creativeNoClipMixin
ItemPlacementContext contextOuter, BlockState stateOuter) ItemPlacementContext contextOuter, BlockState stateOuter)
{ {
PlayerEntity player = contextOuter.getPlayer(); PlayerEntity player = contextOuter.getPlayer();
if (CarpetSettings.creativeNoClip && player != null && player.isCreative() && player.method_31549().flying) if (CarpetSettings.creativeNoClip && player != null && player.isCreative() && player.getAbilities().flying)
{ {
// copy from canPlace // copy from canPlace
VoxelShape voxelShape = state.getCollisionShape(world, pos, context); VoxelShape voxelShape = state.getCollisionShape(world, pos, context);
@@ -30,7 +30,7 @@ public abstract class ContainerMixin
@Inject( method = "method_30010", at = @At(value = "HEAD"), cancellable = true) // on slot click @Inject( method = "method_30010", at = @At(value = "HEAD"), cancellable = true) // on slot click
private void onThrowClick( int slotId, int clickData, SlotActionType actionType, PlayerEntity playerEntity, CallbackInfoReturnable<ItemStack> cir) private void onThrowClick( int slotId, int clickData, SlotActionType actionType, PlayerEntity playerEntity, CallbackInfoReturnable<ItemStack> cir)
{ {
if (actionType == SlotActionType.THROW && CarpetSettings.ctrlQCraftingFix && playerEntity.method_31548().getCursorStack().isEmpty() && slotId >= 0) if (actionType == SlotActionType.THROW && CarpetSettings.ctrlQCraftingFix && playerEntity.getInventory().getCursorStack().isEmpty() && slotId >= 0)
{ {
ItemStack itemStack_1 = ItemStack.EMPTY; ItemStack itemStack_1 = ItemStack.EMPTY;
Slot slot_4 = slots.get(slotId); Slot slot_4 = slots.get(slotId);
@@ -8,7 +8,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.block.CoralBlock; import net.minecraft.block.CoralBlock;
import net.minecraft.block.CoralParentBlock; import net.minecraft.block.CoralParentBlock;
import net.minecraft.block.Fertilizable; import net.minecraft.block.Fertilizable;
import net.minecraft.block.MaterialColor; import net.minecraft.block.MapColor;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.tag.BlockTags; import net.minecraft.tag.BlockTags;
import net.minecraft.tag.FluidTags; import net.minecraft.tag.FluidTags;
@@ -49,12 +49,12 @@ public abstract class CoralBlockMixin implements Fertilizable
else else
coral = new CoralMushroomFeature(DefaultFeatureConfig.CODEC); coral = new CoralMushroomFeature(DefaultFeatureConfig.CODEC);
MaterialColor color = blockUnder.getTopMaterialColor(worldIn, pos); MapColor color = blockUnder.getMapColor(worldIn, pos);
BlockState proper_block = blockUnder; BlockState proper_block = blockUnder;
for (Block block: BlockTags.CORAL_BLOCKS.values()) for (Block block: BlockTags.CORAL_BLOCKS.values())
{ {
proper_block = block.getDefaultState(); proper_block = block.getDefaultState();
if (proper_block.getTopMaterialColor(worldIn,pos) == color) if (proper_block.getMapColor(worldIn,pos) == color)
{ {
break; break;
} }
@@ -30,7 +30,7 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
if (CarpetSettings.creativeFlyDrag != 0.09 && (Object)this instanceof PlayerEntity) if (CarpetSettings.creativeFlyDrag != 0.09 && (Object)this instanceof PlayerEntity)
{ {
PlayerEntity self = (PlayerEntity)(Object)(this); PlayerEntity self = (PlayerEntity)(Object)(this);
if (self.method_31549().flying && ! onGround ) if (self.getAbilities().flying && ! onGround )
return (float)(1.0-CarpetSettings.creativeFlyDrag); return (float)(1.0-CarpetSettings.creativeFlyDrag);
} }
return original; return original;
@@ -43,7 +43,7 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
if (CarpetSettings.creativeFlySpeed != 1.0D && (Object)this instanceof PlayerEntity) if (CarpetSettings.creativeFlySpeed != 1.0D && (Object)this instanceof PlayerEntity)
{ {
PlayerEntity self = (PlayerEntity)(Object)(this); PlayerEntity self = (PlayerEntity)(Object)(this);
if (self.method_31549().flying && !onGround) if (self.getAbilities().flying && !onGround)
cir.setReturnValue(flyingSpeed* (float)CarpetSettings.creativeFlySpeed); cir.setReturnValue(flyingSpeed* (float)CarpetSettings.creativeFlySpeed);
} }
} }
@@ -4,10 +4,10 @@ import carpet.CarpetSettings;
import carpet.fakes.PistonBlockEntityInterface; import carpet.fakes.PistonBlockEntityInterface;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.PistonBlockEntity; import net.minecraft.block.entity.PistonBlockEntity;
import net.minecraft.class_5614;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.render.block.entity.PistonBlockEntityRenderer; import net.minecraft.client.render.block.entity.PistonBlockEntityRenderer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@@ -21,9 +21,9 @@ public abstract class PistonBlockEntityRenderer_movableTEMixin implements BlockE
{ {
BlockEntityRenderDispatcher dispatcher; BlockEntityRenderDispatcher dispatcher;
@Inject(method = "<init>", at = @At("TAIL")) @Inject(method = "<init>", at = @At("TAIL"))
private void onInitCM(class_5614.class_5615 arg, CallbackInfo ci) private void onInitCM(BlockEntityRendererFactory.Arguments arguments, CallbackInfo ci)
{ {
dispatcher = arg.method_32139(); dispatcher = arguments.getRenderDispatcher();
} }
@Inject(method = "render", at = @At(value = "INVOKE", @Inject(method = "render", at = @At(value = "INVOKE",
@@ -47,9 +47,9 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
} }
@Override @Override
public void method_31662(World world) { public void setWorld(World world) {
super.method_31662(world); super.setWorld(world);
if (carriedBlockEntity != null) carriedBlockEntity.method_31662(world); if (carriedBlockEntity != null) carriedBlockEntity.setWorld(world);
} }
public void setCarriedBlockEntity(BlockEntity blockEntity) public void setCarriedBlockEntity(BlockEntity blockEntity)
@@ -59,7 +59,7 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
{ {
((BlockEntity_movableBEMixin)carriedBlockEntity).setPos(pos); ((BlockEntity_movableBEMixin)carriedBlockEntity).setPos(pos);
// this might be little dangerous since pos is final for a hashing reason? // this might be little dangerous since pos is final for a hashing reason?
if (world != null) carriedBlockEntity.method_31662(world); if (world != null) carriedBlockEntity.setWorld(world);
} }
// this.carriedBlockEntity.setPos(this.pos); // this.carriedBlockEntity.setPos(this.pos);
} }
@@ -83,7 +83,7 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
/** /**
* @author 2No2Name * @author 2No2Name
*/ */
@Redirect(method = "method_31707", at = @At(value = "INVOKE", // tick @Redirect(method = "tick", at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z")) target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
private static boolean movableTEsetBlockState0( private static boolean movableTEsetBlockState0(
World world, BlockPos blockPos_1, BlockState blockAState_2, int int_1, World world, BlockPos blockPos_1, BlockState blockAState_2, int int_1,
@@ -29,13 +29,13 @@ public abstract class PistonBlockEntity_playerHandlingMixin
@Inject(method = "method_23672", at = @At("HEAD"), cancellable = true) @Inject(method = "method_23672", at = @At("HEAD"), cancellable = true)
private static void dontPushSpectators(Direction direction, Entity entity, double d, Direction direction2, CallbackInfo ci) private static void dontPushSpectators(Direction direction, Entity entity, double d, Direction direction2, CallbackInfo ci)
{ {
if (CarpetSettings.creativeNoClip && entity instanceof PlayerEntity && (((PlayerEntity) entity).isCreative()) && ((PlayerEntity) entity).method_31549().flying) ci.cancel(); if (CarpetSettings.creativeNoClip && entity instanceof PlayerEntity && (((PlayerEntity) entity).isCreative()) && ((PlayerEntity) entity).getAbilities().flying) ci.cancel();
} }
@Redirect(method = "pushEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setVelocity(DDD)V")) @Redirect(method = "pushEntities", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setVelocity(DDD)V"))
private static void ignoreAccel(Entity entity, double x, double y, double z) private static void ignoreAccel(Entity entity, double x, double y, double z)
{ {
if (CarpetSettings.creativeNoClip && entity instanceof PlayerEntity && (((PlayerEntity) entity).isCreative()) && ((PlayerEntity) entity).method_31549().flying) return; if (CarpetSettings.creativeNoClip && entity instanceof PlayerEntity && (((PlayerEntity) entity).isCreative()) && ((PlayerEntity) entity).getAbilities().flying) return;
entity.setVelocity(x,y,z); entity.setVelocity(x,y,z);
} }
@@ -51,10 +51,10 @@ public abstract class PistonBlock_movableTEMixin extends FacingBlock
block != Blocks.SPAWNER; block != Blocks.SPAWNER;
} }
@Redirect(method = "isMovable", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;method_31709()Z")) // hasBLockENtity @Redirect(method = "isMovable", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;hasBlockEntity()Z"))
private static boolean ifHasBlockEntity(BlockState blockState) private static boolean ifHasBlockEntity(BlockState blockState)
{ {
if (!blockState.method_31709()) if (!blockState.hasBlockEntity())
{ {
return false; return false;
} }
@@ -88,7 +88,7 @@ public abstract class PistonBlock_movableTEMixin extends FacingBlock
for (int i = 0; i < list_1.size(); ++i) for (int i = 0; i < list_1.size(); ++i)
{ {
BlockPos blockpos = list_1.get(i); BlockPos blockpos = list_1.get(i);
BlockEntity blockEntity = (list_2.get(i).method_31709()) ? world_1.getBlockEntity(blockpos) : null; BlockEntity blockEntity = (list_2.get(i).hasBlockEntity()) ? world_1.getBlockEntity(blockpos) : null;
list1_BlockEntities.get().add(blockEntity); list1_BlockEntities.get().add(blockEntity);
if (blockEntity != null) if (blockEntity != null)
{ {
@@ -28,7 +28,7 @@ public abstract class PlayerEntity_creativeNoClipMixin extends LivingEntity
) )
private boolean canClipTroughWorld(PlayerEntity playerEntity) private boolean canClipTroughWorld(PlayerEntity playerEntity)
{ {
return playerEntity.isSpectator() || (CarpetSettings.creativeNoClip && playerEntity.isCreative() && playerEntity.method_31549().flying); return playerEntity.isSpectator() || (CarpetSettings.creativeNoClip && playerEntity.isCreative() && playerEntity.getAbilities().flying);
} }
@@ -38,7 +38,7 @@ public abstract class PlayerEntity_creativeNoClipMixin extends LivingEntity
) )
private boolean collidesWithEntities(PlayerEntity playerEntity) private boolean collidesWithEntities(PlayerEntity playerEntity)
{ {
return playerEntity.isSpectator() || (CarpetSettings.creativeNoClip && playerEntity.isCreative() && playerEntity.method_31549().flying); return playerEntity.isSpectator() || (CarpetSettings.creativeNoClip && playerEntity.isCreative() && playerEntity.getAbilities().flying);
} }
@Redirect(method = "updateSize", at = @At( @Redirect(method = "updateSize", at = @At(
@@ -47,6 +47,6 @@ public abstract class PlayerEntity_creativeNoClipMixin extends LivingEntity
) )
private boolean spectatorsDontPose(PlayerEntity playerEntity) private boolean spectatorsDontPose(PlayerEntity playerEntity)
{ {
return playerEntity.isSpectator() || (CarpetSettings.creativeNoClip && playerEntity.isCreative() && playerEntity.method_31549().flying); return playerEntity.isSpectator() || (CarpetSettings.creativeNoClip && playerEntity.isCreative() && playerEntity.getAbilities().flying);
} }
} }
@@ -257,7 +257,7 @@ public class ServerPlayNetworkHandler_scarpetEventsMixin
{ {
if (PLAYER_SWITCHES_SLOT.isNeeded() && player.getServer() != null && player.getServer().isOnThread()) if (PLAYER_SWITCHES_SLOT.isNeeded() && player.getServer() != null && player.getServer().isOnThread())
{ {
PLAYER_SWITCHES_SLOT.onSlotSwitch(player, player.method_31548().selectedSlot, packet.getSelectedSlot()); PLAYER_SWITCHES_SLOT.onSlotSwitch(player, player.getInventory().selectedSlot, packet.getSelectedSlot());
} }
} }
} }
@@ -39,12 +39,12 @@ public class ServerWorld_scarpetEventMixin
@Redirect(method = "addEntity", at = @At( @Redirect(method = "addEntity", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/class_5579;method_31818(Lnet/minecraft/class_5568;)Z" target = "Lnet/minecraft/class_5579;addEntity(Lnet/minecraft/class_5568;)Z"
)) ))
private boolean onEntityAddedToWorld(class_5579 class_5579, class_5568 arg) private boolean onEntityAddedToWorld(class_5579 class_5579, class_5568 arg)
{ {
Entity entity = (Entity)arg; Entity entity = (Entity)arg;
boolean success = class_5579.method_31818(entity); boolean success = class_5579.addEntity(entity);
if (success) { if (success) {
CarpetEventServer.Event event = ENTITY_LOAD.get(entity.getType()); CarpetEventServer.Event event = ENTITY_LOAD.get(entity.getType());
if (event != null) { if (event != null) {
@@ -4,7 +4,7 @@ import carpet.helpers.TickSpeed;
import carpet.utils.CarpetProfiler; import carpet.utils.CarpetProfiler;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.class_5558; import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
@@ -15,30 +15,29 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(targets = "net.minecraft.world.chunk.WorldChunk$class_5563") @Mixin(targets = "net.minecraft.world.chunk.WorldChunk$DirectBlockEntityTickInvoker")
public class WorldChunkBEList_tickMixin<T extends BlockEntity> public class WorldChunkBEList_tickMixin<T extends BlockEntity>
{ {
@Shadow @Final private T field_27224; @Shadow @Final private T blockEntity;
CarpetProfiler.ProfilerToken entitySection; CarpetProfiler.ProfilerToken entitySection;
@Inject(method = "method_31703", at = @At("HEAD")) @Inject(method = "tick()V", at = @At("HEAD"))
private void startTileEntitySection(CallbackInfo ci) private void startTileEntitySection(CallbackInfo ci)
{ {
entitySection = CarpetProfiler.start_block_entity_section(field_27224.getWorld(), field_27224, CarpetProfiler.TYPE.TILEENTITY); entitySection = CarpetProfiler.start_block_entity_section(blockEntity.getWorld(), blockEntity, CarpetProfiler.TYPE.TILEENTITY);
} }
@Redirect(method = "method_31703", at = @At( @Redirect(method = "tick()V", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/class_5558;tick(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/block/entity/BlockEntity;)V" target = "Lnet/minecraft/block/entity/BlockEntityTicker;tick(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/block/entity/BlockEntity;)V"
)) ))
private void checkProcessTEs(class_5558 class_5558, World world, BlockPos blockPos, BlockState blockState, T blockEntity) private void checkProcessTEs(BlockEntityTicker blockEntityTicker, World world, BlockPos pos, BlockState state, T blockEntity)
{ {
//return class_5562.method_31704() || !TickSpeed.process_entities; // blockEntity can be NULL? happened once with fake player if (TickSpeed.process_entities) blockEntityTicker.tick(world, pos, state, blockEntity);
if (TickSpeed.process_entities) class_5558.tick(world, blockPos, blockState, blockEntity);
} }
@Inject(method = "method_31703", at = @At("RETURN")) @Inject(method = "tick()V", at = @At("RETURN"))
private void endTileEntitySection(CallbackInfo ci) private void endTileEntitySection(CallbackInfo ci)
{ {
CarpetProfiler.end_current_entity_section(entitySection); CarpetProfiler.end_current_entity_section(entitySection);
@@ -42,7 +42,7 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
/* @Nullable */ /* @Nullable */
public abstract BlockEntity getBlockEntity(BlockPos blockPos_1, WorldChunk.CreationType worldChunk$CreationType_1); public abstract BlockEntity getBlockEntity(BlockPos blockPos_1, WorldChunk.CreationType worldChunk$CreationType_1);
@Shadow protected abstract <T extends BlockEntity> void method_31723(T blockEntity); @Shadow protected abstract <T extends BlockEntity> void updateTicker(T blockEntity);
// Fix Failure: If a moving BlockEntity is placed while BlockEntities are ticking, this will not find it and then replace it with a new TileEntity! // Fix Failure: If a moving BlockEntity is placed while BlockEntities are ticking, this will not find it and then replace it with a new TileEntity!
// blockEntity_2 = this.getBlockEntity(blockPos_1, WorldChunk.CreationType.CHECK); // blockEntity_2 = this.getBlockEntity(blockPos_1, WorldChunk.CreationType.CHECK);
@@ -76,7 +76,7 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
int x = blockPos_1.getX() & 15; int x = blockPos_1.getX() & 15;
int y = blockPos_1.getY(); int y = blockPos_1.getY();
int z = blockPos_1.getZ() & 15; int z = blockPos_1.getZ() & 15;
int section = world.method_31602(y); int section = world.getSectionIndex(y);
ChunkSection chunkSection = this.sections[section]; ChunkSection chunkSection = this.sections[section];
if (chunkSection == EMPTY_SECTION) if (chunkSection == EMPTY_SECTION)
{ {
@@ -126,17 +126,17 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
else else
{ {
BlockEntity oldBlockEntity = null; BlockEntity oldBlockEntity = null;
if (oldBlockState.method_31709()) // is BE Provider if (oldBlockState.hasBlockEntity())
{ {
oldBlockEntity = this.getBlockEntity(blockPos_1, WorldChunk.CreationType.CHECK); oldBlockEntity = this.getBlockEntity(blockPos_1, WorldChunk.CreationType.CHECK);
if (oldBlockEntity != null) if (oldBlockEntity != null)
{ {
oldBlockEntity.method_31664(oldBlockState); oldBlockEntity.setCachedState(oldBlockState);
method_31723(oldBlockEntity); updateTicker(oldBlockEntity);
} }
} }
if (oldBlockState.method_31709()) // is BE Provider if (oldBlockState.hasBlockEntity())
{ {
if (newBlockEntity == null) if (newBlockEntity == null)
{ {
@@ -146,8 +146,8 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
{ {
newBlockEntity.cancelRemoval(); newBlockEntity.cancelRemoval();
this.world.addBlockEntity(newBlockEntity); this.world.addBlockEntity(newBlockEntity);
newBlockEntity.method_31664(newBlockState); newBlockEntity.setCachedState(newBlockState);
method_31723(newBlockEntity); updateTicker(newBlockEntity);
} }
} }
@@ -60,7 +60,7 @@ public abstract class World_movableTEMixin implements WorldInterface, WorldAcces
*/ */
public boolean setBlockStateWithBlockEntity(BlockPos blockPos_1, BlockState blockState_1, BlockEntity newBlockEntity, int int_1) public boolean setBlockStateWithBlockEntity(BlockPos blockPos_1, BlockState blockState_1, BlockEntity newBlockEntity, int int_1)
{ {
if (method_31606(blockPos_1) || !this.isClient && isDebugWorld()) return false; if (isOutOfHeightLimit(blockPos_1) || !this.isClient && isDebugWorld()) return false;
WorldChunk worldChunk_1 = this.getWorldChunk(blockPos_1); WorldChunk worldChunk_1 = this.getWorldChunk(blockPos_1);
Block block_1 = blockState_1.getBlock(); Block block_1 = blockState_1.getBlock();
@@ -956,7 +956,7 @@ public class WorldAccess {
expression.addLazyFunction("map_colour", -1, (c, t, lv) -> expression.addLazyFunction("map_colour", -1, (c, t, lv) ->
stateStringQuery(c, "map_colour", lv, (s, p) -> stateStringQuery(c, "map_colour", lv, (s, p) ->
BlockInfo.mapColourName.get(s.getTopMaterialColor(((CarpetContext)c).s.getWorld(), p)))); BlockInfo.mapColourName.get(s.getMapColor(((CarpetContext)c).s.getWorld(), p))));
expression.addLazyFunction("property", -1, (c, t, lv) -> expression.addLazyFunction("property", -1, (c, t, lv) ->
{ {
@@ -442,7 +442,7 @@ public class ShapesRenderer
// some raw shit // some raw shit
public static void drawLine(Tessellator tessellator, BufferBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2, float red1, float grn1, float blu1, float alpha) { public static void drawLine(Tessellator tessellator, BufferBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2, float red1, float grn1, float blu1, float alpha) {
builder.begin(VertexFormat.class_5596.field_27377, VertexFormats.POSITION_COLOR); // 3 // GL LINES builder.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR);
builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).next(); builder.vertex(x1, y1, z1).color(red1, grn1, blu1, alpha).next();
builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).next(); builder.vertex(x2, y2, z2).color(red1, grn1, blu1, alpha).next();
tessellator.draw(); tessellator.draw();
@@ -455,7 +455,7 @@ public class ShapesRenderer
boolean xthick, boolean ythick, boolean zthick, boolean xthick, boolean ythick, boolean zthick,
float red1, float grn1, float blu1, float alpha, float red2, float grn2, float blu2) float red1, float grn1, float blu1, float alpha, float red2, float grn2, float blu2)
{ {
builder.begin(VertexFormat.class_5596.field_27377, VertexFormats.POSITION_COLOR); // 3 /lines builder.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR);
if (xthick) if (xthick)
{ {
builder.vertex(x1, y1, z1).color(red1, grn2, blu2, alpha).next(); builder.vertex(x1, y1, z1).color(red1, grn2, blu2, alpha).next();
@@ -508,7 +508,7 @@ public class ShapesRenderer
boolean xthick, boolean ythick, boolean zthick, boolean xthick, boolean ythick, boolean zthick,
float red1, float grn1, float blu1, float alpha) float red1, float grn1, float blu1, float alpha)
{ {
builder.begin(VertexFormat.class_5596.field_27382, VertexFormats.POSITION_COLOR); // QUADS builder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
if (xthick && ythick) if (xthick && ythick)
{ {
@@ -583,7 +583,7 @@ public class ShapesRenderer
for (int dh = 0; dh < hsteps; dh++) for (int dh = 0; dh < hsteps; dh++)
{ {
float hh = dh*hstep; float hh = dh*hstep;
builder.begin(VertexFormat.class_5596.field_27378, VertexFormats.POSITION_COLOR); // line loop to line strip builder.begin(VertexFormat.DrawMode.LINE_STRIP, VertexFormats.POSITION_COLOR); // line loop to line strip
for (int i = 0; i <= num_steps360+1; i++) for (int i = 0; i <= num_steps360+1; i++)
{ {
float theta = step * i; float theta = step * i;
@@ -599,7 +599,7 @@ public class ShapesRenderer
{ {
for (int i = 0; i <= num_steps180; i++) for (int i = 0; i <= num_steps180; i++)
{ {
builder.begin(VertexFormat.class_5596.field_27378, VertexFormats.POSITION_COLOR); // line loop to line strip builder.begin(VertexFormat.DrawMode.LINE_STRIP, VertexFormats.POSITION_COLOR); // line loop to line strip
float theta = step * i; float theta = step * i;
float x = r * MathHelper.cos(theta); float x = r * MathHelper.cos(theta);
@@ -615,7 +615,7 @@ public class ShapesRenderer
} }
else else
{ {
builder.begin(VertexFormat.class_5596.field_27377, VertexFormats.POSITION_COLOR); //lines builder.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR);
for (int i = 0; i <= num_steps180; i++) for (int i = 0; i <= num_steps180; i++)
{ {
float theta = step * i; float theta = step * i;
@@ -633,7 +633,7 @@ public class ShapesRenderer
for (int dh = 0; dh < hsteps; dh++) for (int dh = 0; dh < hsteps; dh++)
{ {
float hh = dh * hstep; float hh = dh * hstep;
builder.begin(VertexFormat.class_5596.field_27378, VertexFormats.POSITION_COLOR); // line loop to line strip builder.begin(VertexFormat.DrawMode.LINE_STRIP, VertexFormats.POSITION_COLOR); // line loop to line strip
for (int i = 0; i <= num_steps360; i++) for (int i = 0; i <= num_steps360; i++)
{ {
float theta = step * i; float theta = step * i;
@@ -649,7 +649,7 @@ public class ShapesRenderer
{ {
for (int i = 0; i <= num_steps180; i++) for (int i = 0; i <= num_steps180; i++)
{ {
builder.begin(VertexFormat.class_5596.field_27378, VertexFormats.POSITION_COLOR); // line loop to line strip builder.begin(VertexFormat.DrawMode.LINE_STRIP, VertexFormats.POSITION_COLOR); // line loop to line strip
float theta = step * i; float theta = step * i;
float y = r * MathHelper.cos(theta); float y = r * MathHelper.cos(theta);
@@ -664,7 +664,7 @@ public class ShapesRenderer
} }
else else
{ {
builder.begin(VertexFormat.class_5596.field_27377, VertexFormats.POSITION_COLOR); //lines builder.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR);
for (int i = 0; i <= num_steps180; i++) for (int i = 0; i <= num_steps180; i++)
{ {
float theta = step * i; float theta = step * i;
@@ -681,7 +681,7 @@ public class ShapesRenderer
for (int dh = 0; dh < hsteps; dh++) for (int dh = 0; dh < hsteps; dh++)
{ {
float hh = dh * hstep; float hh = dh * hstep;
builder.begin(VertexFormat.class_5596.field_27378, VertexFormats.POSITION_COLOR); // line loop to line strip builder.begin(VertexFormat.DrawMode.LINE_STRIP, VertexFormats.POSITION_COLOR); // line loop to line strip
for (int i = 0; i <= num_steps360; i++) for (int i = 0; i <= num_steps360; i++)
{ {
float theta = step * i; float theta = step * i;
@@ -696,7 +696,7 @@ public class ShapesRenderer
{ {
for (int i = 0; i <= num_steps180; i++) for (int i = 0; i <= num_steps180; i++)
{ {
builder.begin(VertexFormat.class_5596.field_27378, VertexFormats.POSITION_COLOR); // line loop to line strip builder.begin(VertexFormat.DrawMode.LINE_STRIP, VertexFormats.POSITION_COLOR); // line loop to line strip
float theta = step * i; float theta = step * i;
float x = r * MathHelper.cos(theta); float x = r * MathHelper.cos(theta);
@@ -711,7 +711,7 @@ public class ShapesRenderer
} }
else else
{ {
builder.begin(VertexFormat.class_5596.field_27377, VertexFormats.POSITION_COLOR); //lines builder.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR);
for (int i = 0; i <= num_steps180; i++) for (int i = 0; i <= num_steps180; i++)
{ {
float theta = step * i; float theta = step * i;
@@ -738,7 +738,7 @@ public class ShapesRenderer
if (axis == Direction.Axis.Y) if (axis == Direction.Axis.Y)
{ {
builder.begin(VertexFormat.class_5596.field_27381, VertexFormats.POSITION_COLOR); //triangle fan builder.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).next(); builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).next();
for (int i = 0; i <= num_steps360; i++) for (int i = 0; i <= num_steps360; i++)
{ {
@@ -750,7 +750,7 @@ public class ShapesRenderer
tessellator.draw(); tessellator.draw();
if (!isFlat) if (!isFlat)
{ {
builder.begin(VertexFormat.class_5596.field_27381, VertexFormats.POSITION_COLOR); //trifan builder.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
builder.vertex(cx, cy+h, cz).color(red, grn, blu, alpha).next(); builder.vertex(cx, cy+h, cz).color(red, grn, blu, alpha).next();
for (int i = 0; i <= num_steps360; i++) for (int i = 0; i <= num_steps360; i++)
{ {
@@ -761,7 +761,7 @@ public class ShapesRenderer
} }
tessellator.draw(); tessellator.draw();
builder.begin(VertexFormat.class_5596.field_27382, VertexFormats.POSITION_COLOR); // quad strip to quads builder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR); // quad strip to quads
float xp = r * 1; float xp = r * 1;
float zp = r * 0; float zp = r * 0;
for (int i = 1; i <= num_steps360; i++) for (int i = 1; i <= num_steps360; i++)
@@ -782,7 +782,7 @@ public class ShapesRenderer
} }
else if (axis == Direction.Axis.X) else if (axis == Direction.Axis.X)
{ {
builder.begin(VertexFormat.class_5596.field_27381, VertexFormats.POSITION_COLOR); //trifan builder.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).next(); builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).next();
for (int i = 0; i <= num_steps360; i++) for (int i = 0; i <= num_steps360; i++)
{ {
@@ -794,7 +794,7 @@ public class ShapesRenderer
tessellator.draw(); tessellator.draw();
if (!isFlat) if (!isFlat)
{ {
builder.begin(VertexFormat.class_5596.field_27381, VertexFormats.POSITION_COLOR); //trifan builder.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
builder.vertex(cx+h, cy, cz).color(red, grn, blu, alpha).next(); builder.vertex(cx+h, cy, cz).color(red, grn, blu, alpha).next();
for (int i = 0; i <= num_steps360; i++) for (int i = 0; i <= num_steps360; i++)
{ {
@@ -805,7 +805,7 @@ public class ShapesRenderer
} }
tessellator.draw(); tessellator.draw();
builder.begin(VertexFormat.class_5596.field_27382, VertexFormats.POSITION_COLOR); // quad strip to quads builder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR); // quad strip to quads
float yp = r * 1; float yp = r * 1;
float zp = r * 0; float zp = r * 0;
for (int i = 1; i <= num_steps360; i++) for (int i = 1; i <= num_steps360; i++)
@@ -825,7 +825,7 @@ public class ShapesRenderer
} }
else if (axis == Direction.Axis.Z) else if (axis == Direction.Axis.Z)
{ {
builder.begin(VertexFormat.class_5596.field_27381, VertexFormats.POSITION_COLOR); //trifan builder.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).next(); builder.vertex(cx, cy, cz).color(red, grn, blu, alpha).next();
for (int i = 0; i <= num_steps360; i++) for (int i = 0; i <= num_steps360; i++)
{ {
@@ -837,7 +837,7 @@ public class ShapesRenderer
tessellator.draw(); tessellator.draw();
if (!isFlat) if (!isFlat)
{ {
builder.begin(VertexFormat.class_5596.field_27381, VertexFormats.POSITION_COLOR); //trifan builder.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
builder.vertex(cx, cy, cz+h).color(red, grn, blu, alpha).next(); builder.vertex(cx, cy, cz+h).color(red, grn, blu, alpha).next();
for (int i = 0; i <= num_steps360; i++) for (int i = 0; i <= num_steps360; i++)
{ {
@@ -848,7 +848,7 @@ public class ShapesRenderer
} }
tessellator.draw(); tessellator.draw();
builder.begin(VertexFormat.class_5596.field_27382, VertexFormats.POSITION_COLOR); // quad strip to quads builder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR); // quad strip to quads
float xp = r; float xp = r;
float yp = 0; float yp = 0;
for (int i = 1; i <= num_steps360; i++) for (int i = 1; i <= num_steps360; i++)
@@ -878,7 +878,7 @@ public class ShapesRenderer
int num_steps360 = (int)(2*Math.PI / step)+1; int num_steps360 = (int)(2*Math.PI / step)+1;
for (int i = 0; i <= num_steps360; i++) for (int i = 0; i <= num_steps360; i++)
{ {
builder.begin(VertexFormat.class_5596.field_27378, VertexFormats.POSITION_COLOR); //linestrip builder.begin(VertexFormat.DrawMode.LINE_STRIP, VertexFormats.POSITION_COLOR);
float theta = step * i ; float theta = step * i ;
for (int j = 0; j <= num_steps180; j++) for (int j = 0; j <= num_steps180; j++)
{ {
@@ -892,7 +892,7 @@ public class ShapesRenderer
} }
for (int j = 0; j <= num_steps180; j++) for (int j = 0; j <= num_steps180; j++)
{ {
builder.begin(VertexFormat.class_5596.field_27378, VertexFormats.POSITION_COLOR); // line loop to line strip builder.begin(VertexFormat.DrawMode.LINE_STRIP, VertexFormats.POSITION_COLOR); // line loop to line strip
float phi = step * j ; float phi = step * j ;
for (int i = 0; i <= num_steps360; i++) for (int i = 0; i <= num_steps360; i++)
@@ -921,7 +921,7 @@ public class ShapesRenderer
{ {
float theta = i * step; float theta = i * step;
float thetaprime = theta+step; float thetaprime = theta+step;
builder.begin(VertexFormat.class_5596.field_27382, VertexFormats.POSITION_COLOR); // quad strip to quads builder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR); // quad strip to quads
float xb = 0; float xb = 0;
float zb = 0; float zb = 0;
float xbp = 0; float xbp = 0;
@@ -620,7 +620,7 @@ public class EntityValue extends Value
put("selected_slot", (e, a) -> { put("selected_slot", (e, a) -> {
if (e instanceof PlayerEntity) if (e instanceof PlayerEntity)
return new NumericValue(((PlayerEntity) e).method_31548().selectedSlot); //getInventory return new NumericValue(((PlayerEntity) e).getInventory().selectedSlot); //getInventory
return Value.NULL; return Value.NULL;
}); });
@@ -145,7 +145,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
Block block = blockState.getBlock(); Block block = blockState.getBlock();
if (block instanceof InventoryProvider) { if (block instanceof InventoryProvider) {
inventory = ((InventoryProvider)block).getInventory(blockState, world, blockPos); inventory = ((InventoryProvider)block).getInventory(blockState, world, blockPos);
} else if (blockState.method_31709()) { //hasBlockEntity() } else if (blockState.hasBlockEntity()) {
BlockEntity blockEntity = BlockValue.getBlockEntity(world, blockPos); BlockEntity blockEntity = BlockValue.getBlockEntity(world, blockPos);
if (blockEntity instanceof Inventory) { if (blockEntity instanceof Inventory) {
inventory = (Inventory)blockEntity; inventory = (Inventory)blockEntity;
@@ -181,7 +181,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
if (v1 instanceof EntityValue) if (v1 instanceof EntityValue)
{ {
Entity e = ((EntityValue) v1).getEntity(); Entity e = ((EntityValue) v1).getEntity();
if (e instanceof PlayerEntity) inv = ((PlayerEntity) e).method_31548(); if (e instanceof PlayerEntity) inv = ((PlayerEntity) e).getInventory();
else if (e instanceof Inventory) inv = (Inventory) e; else if (e instanceof Inventory) inv = (Inventory) e;
else if (e instanceof VillagerEntity) inv = ((VillagerEntity) e).getInventory(); else if (e instanceof VillagerEntity) inv = ((VillagerEntity) e).getInventory();
@@ -231,7 +231,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
return new InventoryLocator( return new InventoryLocator(
player, player,
player.getBlockPos(), player.getBlockPos(),
isEnder ? player.getEnderChestInventory() : player.method_31548(), isEnder ? player.getEnderChestInventory() : player.getInventory(),
offset + 1, offset + 1,
isEnder isEnder
); );
+76 -55
View File
@@ -3,7 +3,7 @@ package carpet.utils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor; import net.minecraft.block.MapColor;
import net.minecraft.class_5532; // TargetFinder import net.minecraft.class_5532; // TargetFinder
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnReason; import net.minecraft.entity.SpawnReason;
@@ -68,61 +68,81 @@ public class BlockInfo
put(BlockSoundGroup.BONE, "bone"); put(BlockSoundGroup.BONE, "bone");
put(BlockSoundGroup.NETHERITE, "netherite"); put(BlockSoundGroup.NETHERITE, "netherite");
put(BlockSoundGroup.ANCIENT_DEBRIS, "ancient_debris"); put(BlockSoundGroup.ANCIENT_DEBRIS, "ancient_debris");
put(BlockSoundGroup.LODESTONE, "lodestone");
put(BlockSoundGroup.CHAIN, "chain");
put(BlockSoundGroup.NETHER_GOLD_ORE, "nether_gold_ore");
put(BlockSoundGroup.GILDED_BLACKSTONE, "gilded_blackstone");
put(BlockSoundGroup.field_27196, "candle");
put(BlockSoundGroup.field_27197, "amethyst");
put(BlockSoundGroup.field_27198, "amethyst_cluster");
put(BlockSoundGroup.field_27199, "small_amethyst_bud");
put(BlockSoundGroup.field_27200, "large_amethyst_bud");
put(BlockSoundGroup.field_27201, "medium_amethyst_bud");
put(BlockSoundGroup.field_27202, "tuff");
put(BlockSoundGroup.field_27203, "calcite");
put(BlockSoundGroup.field_27204, "copper");
}}; }};
public static final Map<MaterialColor, String> mapColourName = new HashMap<MaterialColor, String>() {{ public static final Map<MapColor, String> mapColourName = new HashMap<MapColor, String>() {{
put(MaterialColor.CLEAR , "air" ); put(MapColor.CLEAR , "air" );
put(MaterialColor.GRASS , "grass" ); put(MapColor.GRASS , "grass" );
put(MaterialColor.SAND , "sand" ); put(MapColor.SAND , "sand" );
put(MaterialColor.WEB , "wool" ); put(MapColor.WEB , "wool" );
put(MaterialColor.LAVA , "tnt" ); put(MapColor.LAVA , "tnt" );
put(MaterialColor.ICE , "ice" ); put(MapColor.ICE , "ice" );
put(MaterialColor.IRON , "iron" ); put(MapColor.IRON , "iron" );
put(MaterialColor.FOLIAGE , "foliage" ); put(MapColor.FOLIAGE , "foliage" );
put(MaterialColor.WHITE , "snow" ); put(MapColor.WHITE , "snow" );
put(MaterialColor.CLAY , "clay" ); put(MapColor.CLAY , "clay" );
put(MaterialColor.DIRT , "dirt" ); put(MapColor.DIRT , "dirt" );
put(MaterialColor.STONE , "stone" ); put(MapColor.STONE , "stone" );
put(MaterialColor.WATER , "water" ); put(MapColor.WATER , "water" );
put(MaterialColor.WOOD , "wood" ); put(MapColor.WOOD , "wood" );
put(MaterialColor.QUARTZ , "quartz" ); put(MapColor.QUARTZ , "quartz" );
put(MaterialColor.ORANGE , "adobe" ); put(MapColor.ORANGE , "adobe" );
put(MaterialColor.MAGENTA , "magenta" ); put(MapColor.MAGENTA , "magenta" );
put(MaterialColor.LIGHT_BLUE, "light_blue"); put(MapColor.LIGHT_BLUE, "light_blue");
put(MaterialColor.YELLOW , "yellow" ); put(MapColor.YELLOW , "yellow" );
put(MaterialColor.LIME , "lime" ); put(MapColor.LIME , "lime" );
put(MaterialColor.PINK , "pink" ); put(MapColor.PINK , "pink" );
put(MaterialColor.GRAY , "gray" ); put(MapColor.GRAY , "gray" );
put(MaterialColor.LIGHT_GRAY, "light_gray"); put(MapColor.LIGHT_GRAY, "light_gray");
put(MaterialColor.CYAN , "cyan" ); put(MapColor.CYAN , "cyan" );
put(MaterialColor.PURPLE , "purple" ); put(MapColor.PURPLE , "purple" );
put(MaterialColor.BLUE , "blue" ); put(MapColor.BLUE , "blue" );
put(MaterialColor.BROWN , "brown" ); put(MapColor.BROWN , "brown" );
put(MaterialColor.GREEN , "green" ); put(MapColor.GREEN , "green" );
put(MaterialColor.RED , "red" ); put(MapColor.RED , "red" );
put(MaterialColor.BLACK , "black" ); put(MapColor.BLACK , "black" );
put(MaterialColor.GOLD , "gold" ); put(MapColor.GOLD , "gold" );
put(MaterialColor.DIAMOND , "diamond" ); put(MapColor.DIAMOND , "diamond" );
put(MaterialColor.LAPIS , "lapis" ); put(MapColor.LAPIS , "lapis" );
put(MaterialColor.EMERALD , "emerald" ); put(MapColor.EMERALD , "emerald" );
put(MaterialColor.SPRUCE , "obsidian" ); put(MapColor.SPRUCE , "obsidian" );
put(MaterialColor.NETHER , "netherrack"); //TODO fix these put(MapColor.NETHER , "netherrack"); //TODO fix these
put(MaterialColor.WHITE_TERRACOTTA , "white_terracotta" ); put(MapColor.WHITE_TERRACOTTA , "white_terracotta" );
put(MaterialColor.ORANGE_TERRACOTTA , "orange_terracotta" ); put(MapColor.ORANGE_TERRACOTTA , "orange_terracotta" );
put(MaterialColor.MAGENTA_TERRACOTTA , "magenta_terracotta" ); put(MapColor.MAGENTA_TERRACOTTA , "magenta_terracotta" );
put(MaterialColor.LIGHT_BLUE_TERRACOTTA, "light_blue_terracotta" ); put(MapColor.LIGHT_BLUE_TERRACOTTA, "light_blue_terracotta" );
put(MaterialColor.YELLOW_TERRACOTTA , "yellow_terracotta" ); put(MapColor.YELLOW_TERRACOTTA , "yellow_terracotta" );
put(MaterialColor.LIME_TERRACOTTA , "lime_terracotta" ); put(MapColor.LIME_TERRACOTTA , "lime_terracotta" );
put(MaterialColor.PINK_TERRACOTTA , "pink_terracotta" ); put(MapColor.PINK_TERRACOTTA , "pink_terracotta" );
put(MaterialColor.GRAY_TERRACOTTA , "gray_terracotta" ); put(MapColor.GRAY_TERRACOTTA , "gray_terracotta" );
put(MaterialColor.LIGHT_GRAY_TERRACOTTA, "light_gray_terracotta" ); put(MapColor.LIGHT_GRAY_TERRACOTTA, "light_gray_terracotta" );
put(MaterialColor.CYAN_TERRACOTTA , "cyan_terracotta" ); put(MapColor.CYAN_TERRACOTTA , "cyan_terracotta" );
put(MaterialColor.PURPLE_TERRACOTTA , "purple_terracotta" ); put(MapColor.PURPLE_TERRACOTTA , "purple_terracotta" );
put(MaterialColor.BLUE_TERRACOTTA , "blue_terracotta" ); put(MapColor.BLUE_TERRACOTTA , "blue_terracotta" );
put(MaterialColor.BROWN_TERRACOTTA , "brown_terracotta" ); put(MapColor.BROWN_TERRACOTTA , "brown_terracotta" );
put(MaterialColor.GREEN_TERRACOTTA , "green_terracotta" ); put(MapColor.GREEN_TERRACOTTA , "green_terracotta" );
put(MaterialColor.RED_TERRACOTTA , "red_terracotta" ); put(MapColor.RED_TERRACOTTA , "red_terracotta" );
put(MaterialColor.BLACK_TERRACOTTA , "black_terracotta" ); put(MapColor.BLACK_TERRACOTTA , "black_terracotta" );
put(MapColor.CRIMSON_NYLIUM , "crimson_nylium" );
put(MapColor.CRIMSON_STEM , "crimson_stem" );
put(MapColor.CRIMSON_HYPHAE , "crimson_hyphae" );
put(MapColor.WARPED_NYLIUM , "warped_nylium" );
put(MapColor.WARPED_STEM , "warped_stem" );
put(MapColor.WARPED_HYPHAE , "warped_hyphae" );
put(MapColor.WARPED_WART , "warped_wart" );
}}; }};
public static final Map<Material, String> materialName = new HashMap<Material, String>() {{ public static final Map<Material, String> materialName = new HashMap<Material, String>() {{
@@ -169,6 +189,7 @@ public class BlockInfo
put(Material.GOURD , "gourd" ); put(Material.GOURD , "gourd" );
put(Material.EGG , "dragon_egg" ); put(Material.EGG , "dragon_egg" );
put(Material.CAKE , "cake" ); put(Material.CAKE , "cake" );
put(Material.AMETHYST , "amethyst" );
}}; }};
public static List<BaseText> blockInfo(BlockPos pos, ServerWorld world) public static List<BaseText> blockInfo(BlockPos pos, ServerWorld world)
@@ -186,7 +207,7 @@ public class BlockInfo
lst.add(Messenger.s("=====================================")); lst.add(Messenger.s("====================================="));
lst.add(Messenger.s(String.format("Block info for %s%s (id %d%s):",Registry.BLOCK.getId(block),metastring, Registry.BLOCK.getRawId(block), metastring ))); lst.add(Messenger.s(String.format("Block info for %s%s (id %d%s):",Registry.BLOCK.getId(block),metastring, Registry.BLOCK.getRawId(block), metastring )));
lst.add(Messenger.s(String.format(" - Material: %s", materialName.get(material)))); lst.add(Messenger.s(String.format(" - Material: %s", materialName.get(material))));
lst.add(Messenger.s(String.format(" - Map colour: %s", mapColourName.get(state.getTopMaterialColor(world, pos))))); lst.add(Messenger.s(String.format(" - Map colour: %s", mapColourName.get(state.getMapColor(world, pos)))));
lst.add(Messenger.s(String.format(" - Sound type: %s", soundName.get(block.getSoundGroup(state))))); lst.add(Messenger.s(String.format(" - Sound type: %s", soundName.get(block.getSoundGroup(state)))));
lst.add(Messenger.s("")); lst.add(Messenger.s(""));
lst.add(Messenger.s(String.format(" - Full block: %s", state.isFullCube(world, pos)))); // isFullCube() ))); lst.add(Messenger.s(String.format(" - Full block: %s", state.isFullCube(world, pos)))); // isFullCube() )));
+4 -4
View File
@@ -3,7 +3,7 @@ package carpet.utils;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import carpet.helpers.HopperCounter; import carpet.helpers.HopperCounter;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor; import net.minecraft.block.MapColor;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@@ -20,12 +20,12 @@ import java.util.List;
public class WoolTool public class WoolTool
{ {
private static final HashMap<MaterialColor,DyeColor> Material2Dye = new HashMap<>(); private static final HashMap<MapColor,DyeColor> Material2Dye = new HashMap<>();
static static
{ {
for (DyeColor color: DyeColor.values()) for (DyeColor color: DyeColor.values())
{ {
Material2Dye.put(color.getMaterialColor(),color); Material2Dye.put(color.getMapColor(),color);
} }
} }
@@ -98,6 +98,6 @@ public class WoolTool
BlockState state = worldIn.getBlockState(pos); BlockState state = worldIn.getBlockState(pos);
if (state.getMaterial() != Material.WOOL || !state.isSolidBlock(worldIn, pos)) //isSimpleFullBlock if (state.getMaterial() != Material.WOOL || !state.isSolidBlock(worldIn, pos)) //isSimpleFullBlock
return null; return null;
return Material2Dye.get(state.getTopMaterialColor(worldIn, pos)); return Material2Dye.get(state.getMapColor(worldIn, pos));
} }
} }