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
+174 -154

No files matched your search

@@ -4,7 +4,7 @@ import carpet.CarpetSettings;
import net.minecraft.block.AbstractCauldronBlock;
import net.minecraft.block.BlockState;
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.item.BlockItem;
import net.minecraft.item.ItemStack;
@@ -19,13 +19,13 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(AbstractCauldronBlock.class)
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;"))
private ActionResult wrapInteractor(class_5620 class_5620, BlockState blockState, World world, BlockPos blockPos, PlayerEntity playerEntity, Hand hand, ItemStack itemStack)
@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(CauldronBehavior cauldronBehavior, BlockState blockState, World world, BlockPos blockPos, PlayerEntity playerEntity, Hand hand, ItemStack itemStack)
{
int count = -1;
if (CarpetSettings.stackableShulkerBoxes && itemStack.getItem() instanceof BlockItem && ((BlockItem)itemStack.getItem()).getBlock() instanceof ShulkerBoxBlock)
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())
{
ItemStack current = playerEntity.getStackInHand(hand);
@@ -24,7 +24,7 @@ public class BlockItem_creativeNoClipMixin
ItemPlacementContext contextOuter, BlockState stateOuter)
{
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
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
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;
Slot slot_4 = slots.get(slotId);
@@ -8,7 +8,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.block.CoralBlock;
import net.minecraft.block.CoralParentBlock;
import net.minecraft.block.Fertilizable;
import net.minecraft.block.MaterialColor;
import net.minecraft.block.MapColor;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.tag.BlockTags;
import net.minecraft.tag.FluidTags;
@@ -49,12 +49,12 @@ public abstract class CoralBlockMixin implements Fertilizable
else
coral = new CoralMushroomFeature(DefaultFeatureConfig.CODEC);
MaterialColor color = blockUnder.getTopMaterialColor(worldIn, pos);
MapColor color = blockUnder.getMapColor(worldIn, pos);
BlockState proper_block = blockUnder;
for (Block block: BlockTags.CORAL_BLOCKS.values())
{
proper_block = block.getDefaultState();
if (proper_block.getTopMaterialColor(worldIn,pos) == color)
if (proper_block.getMapColor(worldIn,pos) == color)
{
break;
}
@@ -30,7 +30,7 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
if (CarpetSettings.creativeFlyDrag != 0.09 && (Object)this instanceof PlayerEntity)
{
PlayerEntity self = (PlayerEntity)(Object)(this);
if (self.method_31549().flying && ! onGround )
if (self.getAbilities().flying && ! onGround )
return (float)(1.0-CarpetSettings.creativeFlyDrag);
}
return original;
@@ -43,7 +43,7 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
if (CarpetSettings.creativeFlySpeed != 1.0D && (Object)this instanceof PlayerEntity)
{
PlayerEntity self = (PlayerEntity)(Object)(this);
if (self.method_31549().flying && !onGround)
if (self.getAbilities().flying && !onGround)
cir.setReturnValue(flyingSpeed* (float)CarpetSettings.creativeFlySpeed);
}
}
@@ -4,10 +4,10 @@ import carpet.CarpetSettings;
import carpet.fakes.PistonBlockEntityInterface;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.PistonBlockEntity;
import net.minecraft.class_5614;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
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.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
@@ -21,9 +21,9 @@ public abstract class PistonBlockEntityRenderer_movableTEMixin implements BlockE
{
BlockEntityRenderDispatcher dispatcher;
@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",
@@ -47,9 +47,9 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
}
@Override
public void method_31662(World world) {
super.method_31662(world);
if (carriedBlockEntity != null) carriedBlockEntity.method_31662(world);
public void setWorld(World world) {
super.setWorld(world);
if (carriedBlockEntity != null) carriedBlockEntity.setWorld(world);
}
public void setCarriedBlockEntity(BlockEntity blockEntity)
@@ -59,7 +59,7 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
{
((BlockEntity_movableBEMixin)carriedBlockEntity).setPos(pos);
// 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);
}
@@ -83,7 +83,7 @@ public abstract class PistonBlockEntity_movableTEMixin extends BlockEntity imple
/**
* @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"))
private static boolean movableTEsetBlockState0(
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)
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"))
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);
}
@@ -51,10 +51,10 @@ public abstract class PistonBlock_movableTEMixin extends FacingBlock
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)
{
if (!blockState.method_31709())
if (!blockState.hasBlockEntity())
{
return false;
}
@@ -88,7 +88,7 @@ public abstract class PistonBlock_movableTEMixin extends FacingBlock
for (int i = 0; i < list_1.size(); ++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);
if (blockEntity != null)
{
@@ -28,7 +28,7 @@ public abstract class PlayerEntity_creativeNoClipMixin extends LivingEntity
)
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)
{
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(
@@ -47,6 +47,6 @@ public abstract class PlayerEntity_creativeNoClipMixin extends LivingEntity
)
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())
{
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(
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)
{
Entity entity = (Entity)arg;
boolean success = class_5579.method_31818(entity);
boolean success = class_5579.addEntity(entity);
if (success) {
CarpetEventServer.Event event = ENTITY_LOAD.get(entity.getType());
if (event != null) {
@@ -4,7 +4,7 @@ import carpet.helpers.TickSpeed;
import carpet.utils.CarpetProfiler;
import net.minecraft.block.BlockState;
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.world.World;
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.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>
{
@Shadow @Final private T field_27224;
@Shadow @Final private T blockEntity;
CarpetProfiler.ProfilerToken entitySection;
@Inject(method = "method_31703", at = @At("HEAD"))
@Inject(method = "tick()V", at = @At("HEAD"))
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",
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) class_5558.tick(world, blockPos, blockState, blockEntity);
if (TickSpeed.process_entities) blockEntityTicker.tick(world, pos, state, blockEntity);
}
@Inject(method = "method_31703", at = @At("RETURN"))
@Inject(method = "tick()V", at = @At("RETURN"))
private void endTileEntitySection(CallbackInfo ci)
{
CarpetProfiler.end_current_entity_section(entitySection);
@@ -42,7 +42,7 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
/* @Nullable */
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!
// 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 y = blockPos_1.getY();
int z = blockPos_1.getZ() & 15;
int section = world.method_31602(y);
int section = world.getSectionIndex(y);
ChunkSection chunkSection = this.sections[section];
if (chunkSection == EMPTY_SECTION)
{
@@ -126,17 +126,17 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
else
{
BlockEntity oldBlockEntity = null;
if (oldBlockState.method_31709()) // is BE Provider
if (oldBlockState.hasBlockEntity())
{
oldBlockEntity = this.getBlockEntity(blockPos_1, WorldChunk.CreationType.CHECK);
if (oldBlockEntity != null)
{
oldBlockEntity.method_31664(oldBlockState);
method_31723(oldBlockEntity);
oldBlockEntity.setCachedState(oldBlockState);
updateTicker(oldBlockEntity);
}
}
if (oldBlockState.method_31709()) // is BE Provider
if (oldBlockState.hasBlockEntity())
{
if (newBlockEntity == null)
{
@@ -146,8 +146,8 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface
{
newBlockEntity.cancelRemoval();
this.world.addBlockEntity(newBlockEntity);
newBlockEntity.method_31664(newBlockState);
method_31723(newBlockEntity);
newBlockEntity.setCachedState(newBlockState);
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)
{
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);
Block block_1 = blockState_1.getBlock();