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