mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 20:45:10 +01:00
Merge pull request #330 from Snownee/fix
Bug fixes and deployer feeding
This commit is contained in:
commit
34ce4c9a3e
@ -44,6 +44,9 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
||||
renderBackground();
|
||||
renderWindow(mouseX, mouseY, partialTicks);
|
||||
|
||||
for (Widget widget : widgets)
|
||||
widget.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
super.render(mouseX, mouseY, partialTicks);
|
||||
|
||||
GlStateManager.enableAlphaTest();
|
||||
@ -52,9 +55,6 @@ public abstract class AbstractSimiContainerScreen<T extends Container> extends C
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableDepthTest();
|
||||
|
||||
for (Widget widget : widgets)
|
||||
widget.render(mouseX, mouseY, partialTicks);
|
||||
renderWindowForeground(mouseX, mouseY, partialTicks);
|
||||
for (Widget widget : widgets)
|
||||
widget.renderToolTip(mouseX, mouseY);
|
||||
|
@ -30,6 +30,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@ -82,6 +83,16 @@ public class DeployerFakePlayer extends FakePlayer {
|
||||
return 1 / 64f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEat(boolean ignoreHunger) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onFoodEaten(World world, ItemStack stack) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void deployerHasEyesOnHisFeet(EntityEvent.EyeHeight event) {
|
||||
if (event.getEntity() instanceof DeployerFakePlayer)
|
||||
|
@ -20,6 +20,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
@ -137,6 +138,14 @@ public class DeployerHandler {
|
||||
&& stack.interactWithEntity(player, (LivingEntity) entity, hand))
|
||||
success = true;
|
||||
}
|
||||
if (!success && stack.isFood() && entity instanceof PlayerEntity) {
|
||||
PlayerEntity playerEntity = (PlayerEntity) entity;
|
||||
if (playerEntity.canEat(item.getFood().canEatWhenFull())) {
|
||||
playerEntity.onFoodEaten(world, stack);
|
||||
player.spawnedItemEffects = stack.copy();
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Punch entity
|
||||
@ -266,8 +275,6 @@ public class DeployerHandler {
|
||||
CompoundNBT tag = stack.getOrCreateTag();
|
||||
if (stack.getItem() instanceof SandPaperItem && tag.contains("Polishing"))
|
||||
player.spawnedItemEffects = ItemStack.read(tag.getCompound("Polishing"));
|
||||
if (stack.isFood())
|
||||
player.spawnedItemEffects = stack.copy();
|
||||
|
||||
if (!player.getActiveItemStack().isEmpty())
|
||||
player.setHeldItem(hand, stack.onItemUseFinish(world, player));
|
||||
|
@ -17,7 +17,9 @@ import com.simibubi.create.modules.logistics.InWorldProcessing.Type;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.monster.EndermanEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
@ -113,14 +115,21 @@ public class AirCurrent {
|
||||
} else {
|
||||
switch (processingType) {
|
||||
case BLASTING:
|
||||
entity.setFire(10);
|
||||
entity.attackEntityFrom(damageSourceLava, 4);
|
||||
if (!entity.isImmuneToFire()) {
|
||||
entity.setFire(10);
|
||||
entity.attackEntityFrom(damageSourceLava, 4);
|
||||
}
|
||||
break;
|
||||
case SMOKING:
|
||||
entity.setFire(2);
|
||||
entity.attackEntityFrom(damageSourceFire, 2);
|
||||
if (!entity.isImmuneToFire()) {
|
||||
entity.setFire(2);
|
||||
entity.attackEntityFrom(damageSourceFire, 2);
|
||||
}
|
||||
break;
|
||||
case SPLASHING:
|
||||
if (entity instanceof EndermanEntity || entity.getType() == EntityType.SNOW_GOLEM || entity.getType() == EntityType.BLAZE) {
|
||||
entity.attackEntityFrom(DamageSource.DROWN, 2);
|
||||
}
|
||||
if (!entity.isBurning())
|
||||
break;
|
||||
entity.extinguish();
|
||||
|
@ -4,6 +4,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.foundation.block.IHaveColorHandler;
|
||||
import com.simibubi.create.foundation.block.IHaveCustomBlockModel;
|
||||
import com.simibubi.create.foundation.block.IHaveNoBlockItem;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
@ -15,6 +16,8 @@ import net.minecraft.block.FourWayBlock;
|
||||
import net.minecraft.block.PaneBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.material.MaterialColor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@ -47,7 +50,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class WindowInABlockBlock extends PaneBlock
|
||||
implements ITE<WindowInABlockTileEntity>, IHaveNoBlockItem, IHaveCustomBlockModel {
|
||||
implements ITE<WindowInABlockTileEntity>, IHaveNoBlockItem, IHaveCustomBlockModel, IHaveColorHandler {
|
||||
|
||||
public WindowInABlockBlock() {
|
||||
super(Properties.create(Material.ROCK));
|
||||
@ -210,6 +213,7 @@ public class WindowInABlockBlock extends PaneBlock
|
||||
return Blocks.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
|
||||
return false;
|
||||
@ -226,4 +230,16 @@ public class WindowInABlockBlock extends PaneBlock
|
||||
return WindowInABlockTileEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IBlockColor getColorHandler() {
|
||||
return (state, world, pos, index) -> {
|
||||
try {
|
||||
BlockState surrounding = getSurroundingBlockState(world, pos);
|
||||
return Minecraft.getInstance().getBlockColors().getColor(surrounding, world, pos, index);
|
||||
} catch (Exception e) {}
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import net.minecraftforge.common.util.FakePlayer;
|
||||
public class SandPaperItem extends Item implements IHaveCustomItemModel {
|
||||
|
||||
public SandPaperItem(Properties properties) {
|
||||
super(properties);
|
||||
super(properties.maxDamage(8));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -173,21 +173,6 @@ public class SandPaperItem extends Item implements IHaveCustomItemModel {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemStackLimit(ItemStack stack) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDamage(ItemStack stack) {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemEnchantability() {
|
||||
return 5;
|
||||
|
Loading…
Reference in New Issue
Block a user