Skip to content

Commit

Permalink
Invert some cover animations when set to import
Browse files Browse the repository at this point in the history
fix ru_ru and zh_cn lang key from last commit
  • Loading branch information
serenibyss committed Dec 7, 2021
1 parent 3846c2b commit acfeb9b
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/main/java/gregtech/api/render/Textures.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,11 @@ public class Textures {
public static final SimpleOverlayRenderer ENERGY_OUT_ULTRA = new SimpleOverlayRenderer("overlay/machine/overlay_energy_out_ultra");
public static final SimpleOverlayRenderer ENERGY_IN_ULTRA = new SimpleOverlayRenderer("overlay/machine/overlay_energy_in_ultra");
public static final SimpleOverlayRenderer CONVEYOR_OVERLAY = new SimpleOverlayRenderer("cover/overlay_conveyor");
public static final SimpleOverlayRenderer CONVEYOR_OVERLAY_INVERTED = new SimpleOverlayRenderer("cover/overlay_conveyor_inverted");
public static final SimpleOverlayRenderer ARM_OVERLAY = new SimpleOverlayRenderer("cover/overlay_arm");
public static final SimpleOverlayRenderer ARM_OVERLAY_INVERTED = new SimpleOverlayRenderer("cover/overlay_arm_inverted");
public static final SimpleOverlayRenderer PUMP_OVERLAY = new SimpleOverlayRenderer("cover/overlay_pump");
public static final SimpleOverlayRenderer PUMP_OVERLAY_INVERTED = new SimpleOverlayRenderer("cover/overlay_pump_inverted");
public static final SimpleOverlayRenderer AIR_VENT_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_air_vent");
public static final SimpleOverlayRenderer BLOWER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_blower");
public static final SimpleOverlayRenderer BLOWER_ACTIVE_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_blower_active");
Expand Down
29 changes: 28 additions & 1 deletion src/main/java/gregtech/common/covers/CoverConveyor.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.MathHelper;
Expand Down Expand Up @@ -79,6 +80,7 @@ protected void adjustTransferRate(int amount) {

protected void setConveyorMode(ConveyorMode conveyorMode) {
this.conveyorMode = conveyorMode;
writeUpdateData(1, buf -> buf.writeEnumValue(conveyorMode));
coverHolder.markDirty();
}

Expand Down Expand Up @@ -404,7 +406,11 @@ public void onRemoved() {

@Override
public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) {
Textures.CONVEYOR_OVERLAY.renderSided(attachedSide, plateBox, renderState, pipeline, translation);
if (conveyorMode == ConveyorMode.EXPORT) {
Textures.CONVEYOR_OVERLAY.renderSided(attachedSide, plateBox, renderState, pipeline, translation);
} else {
Textures.CONVEYOR_OVERLAY_INVERTED.renderSided(attachedSide, plateBox, renderState, pipeline, translation);
}
}

@Override
Expand Down Expand Up @@ -495,6 +501,27 @@ public void setWorkingEnabled(boolean isActivationAllowed) {
this.isWorkingAllowed = isActivationAllowed;
}

@Override
public void readUpdateData(int id, PacketBuffer packetBuffer) {
super.readUpdateData(id, packetBuffer);
if (id == 1) {
this.conveyorMode = packetBuffer.readEnumValue(ConveyorMode.class);
coverHolder.scheduleRenderUpdate();
}
}

@Override
public void writeInitialSyncData(PacketBuffer packetBuffer) {
super.writeInitialSyncData(packetBuffer);
packetBuffer.writeEnumValue(conveyorMode);
}

@Override
public void readInitialSyncData(PacketBuffer packetBuffer) {
super.readInitialSyncData(packetBuffer);
this.conveyorMode = packetBuffer.readEnumValue(ConveyorMode.class);
}

@Override
public void writeToNBT(NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
Expand Down
29 changes: 28 additions & 1 deletion src/main/java/gregtech/common/covers/CoverPump.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos.PooledMutableBlockPos;
Expand Down Expand Up @@ -84,6 +85,7 @@ protected void adjustTransferRate(int amount) {

public void setPumpMode(PumpMode pumpMode) {
this.pumpMode = pumpMode;
writeUpdateData(1, buf -> buf.writeEnumValue(pumpMode));
coverHolder.markDirty();
}

Expand Down Expand Up @@ -246,6 +248,27 @@ public EnumActionResult onScrewdriverClick(EntityPlayer playerIn, EnumHand hand,
return EnumActionResult.SUCCESS;
}

@Override
public void readUpdateData(int id, PacketBuffer packetBuffer) {
super.readUpdateData(id, packetBuffer);
if (id == 1) {
this.pumpMode = packetBuffer.readEnumValue(PumpMode.class);
coverHolder.scheduleRenderUpdate();
}
}

@Override
public void writeInitialSyncData(PacketBuffer packetBuffer) {
super.writeInitialSyncData(packetBuffer);
packetBuffer.writeEnumValue(pumpMode);
}

@Override
public void readInitialSyncData(PacketBuffer packetBuffer) {
super.readInitialSyncData(packetBuffer);
this.pumpMode = packetBuffer.readEnumValue(PumpMode.class);
}

@Override
public boolean canAttach() {
return coverHolder.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, attachedSide) != null;
Expand All @@ -267,7 +290,11 @@ public void onRemoved() {

@Override
public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) {
Textures.PUMP_OVERLAY.renderSided(attachedSide, plateBox, renderState, pipeline, translation);
if (pumpMode == PumpMode.EXPORT) {
Textures.PUMP_OVERLAY.renderSided(attachedSide, plateBox, renderState, pipeline, translation);
} else {
Textures.PUMP_OVERLAY_INVERTED.renderSided(attachedSide, plateBox, renderState, pipeline, translation);
}
}

@Override
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/gregtech/common/covers/CoverRoboticArm.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ public CoverRoboticArm(ICoverable coverable, EnumFacing attachedSide, int tier,

@Override
public void renderCover(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, Cuboid6 plateBox, BlockRenderLayer layer) {
Textures.ARM_OVERLAY.renderSided(attachedSide, plateBox, renderState, pipeline, translation);
if (conveyorMode == ConveyorMode.EXPORT) {
Textures.ARM_OVERLAY.renderSided(attachedSide, plateBox, renderState, pipeline, translation);
} else {
Textures.ARM_OVERLAY_INVERTED.renderSided(attachedSide, plateBox, renderState, pipeline, translation);
}
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/gregtech/lang/ru_ru.lang
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ cover.fluid_regulator.transfer_mode.description=§eTransfer Any§r - in this mod
cover.fluid_regulator.supply_exact=Supply Exact: %s
cover.fluid_regulator.keep_exact=Keep Exact: %s

cover.machine_controller.name=Настройки контроллера машины
cover.machine_controller.title=Настройки контроллера машины
cover.machine_controller.normal=Нормально
cover.machine_controller.inverted=Инвертировано
cover.machine_controller.redstone=Минимальный Редстоун сигнал: %d
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/gregtech/lang/zh_cn.lang
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ cover.pump.mode.export=模式: 过滤输出
cover.pump.mode.import=模式: 过滤输入
cover.pump.fluid_filter.title=流体过滤

cover.machine_controller.name=机器控制覆盖板设置
cover.machine_controller.title=机器控制覆盖板设置
cover.machine_controller.normal=不反转信号
cover.machine_controller.inverted=反转信号
cover.machine_controller.redstone=最小红石信号强度: %d
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"animation":{
"frametime":2
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"animation":{
"frametime":2
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"animation":{
"frametime":2
}
}

0 comments on commit acfeb9b

Please sign in to comment.